@Override
	protected void exitSubrule(GrammarAST tree) {
		if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) {
			for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) {
				entry.getValue().v = 2;
			}
		}

		if (tree.getType() == CLOSURE || tree.getType() == OPTIONAL) {
			// Everything inside a closure is optional, so the minimum
			// number of occurrences for all elements is 0.
			minFrequencies.peek().clear();
		}
	}
Generate a frequency set as the union of two input sets, with the
values clipped to a specified maximum value. If an element is
contained in both sets, the value for the output, prior to clipping,
will be the sum of the two input values.

@param a The first set.
@param b The second set.
@param clip The maximum value to allow for any output.
@return The sum of the two sets, with the individual elements clipped
to the maximum value given by {@code clip}.
tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java