Package org.antlr.v4.runtime.atn
Class OrderedATNConfigSet
java.lang.Object
org.antlr.v4.runtime.atn.ATNConfigSet
org.antlr.v4.runtime.atn.OrderedATNConfigSet
Lexer configuration set that merges configs only when they are fully equal
(including prediction context and lexer actions), preserving first-match
preference order among alternatives.
PERF: The merge index keys configs by ATNConfig.hashCode(), which
is cached on ATNConfig after the first computation. Capacity-aware
construction reduces rehashing during lexer reach/closure fan-out.
-
Field Summary
Fields inherited from class org.antlr.v4.runtime.atn.ATNConfigSet
SCRATCH_CAPACITY_FLOOR, SPARSE_CLEAR_CAPACITY_FACTOR -
Constructor Summary
ConstructorsConstructorDescriptionOrderedATNConfigSet(int expectedSize) Constructs an empty, writable ordered config set with the given capacity hint for primary storage.OrderedATNConfigSet(ATNConfigSet set, boolean readonly) -
Method Summary
Methods inherited from class org.antlr.v4.runtime.atn.ATNConfigSet
add, add, addAll, addAll, clear, clearExplicitSemanticContext, contains, containsAll, ensureWritable, equals, get, getConflictInfo, getConflictingAlts, getDipsIntoOuterContext, getRepresentedAlternatives, getStates, getUniqueAlt, hashCode, hasSemanticContext, isEmpty, isExactConflict, isOutermostConfigSet, isReadOnly, iterator, markExplicitSemanticContext, optimizeConfigs, remove, remove, removeAll, retainAll, scratchCapacity, setConflictInfo, setOutermostConfigSet, size, toArray, toArray, toString, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
OrderedATNConfigSet
public OrderedATNConfigSet() -
OrderedATNConfigSet
public OrderedATNConfigSet(int expectedSize) Constructs an empty, writable ordered config set with the given capacity hint for primary storage. SeeATNConfigSet(int).- Parameters:
expectedSize- expected number of configurations, or<= 0for the default map/list capacities
-
OrderedATNConfigSet
-
-
Method Details
-
clone
- Overrides:
clonein classATNConfigSet
-
getKey
Description copied from class:ATNConfigSetPacked(stateNumber, alt)key. The alternative keeps the full 24 bits stored byATNConfig.- Overrides:
getKeyin classATNConfigSet
-
canMerge
Description copied from class:ATNConfigSetWhetherleftmay merge into the existingrightconfig.PERF: The packed
leftKeyalready encodes(stateNumber, alt)(seeATNConfigSet.getKey(org.antlr.v4.runtime.atn.ATNConfig)). Comparing keys alone establishes state+alt equality; a separategetState().stateNumberwalk is redundant on the hot merge path.- Overrides:
canMergein classATNConfigSet
-