ATNConfig). As
configurations are added to the set, they are merged with other
ATNConfig instances already in the set when possible using the
graph-structured stack.
An instance of this class represents the complete set of positions (with context) in an ATN which would be associated with a single DFA state. Its internal representation is more complex than traditional state used for NFA to DFA conversion due to performance requirements (both improving speed and reducing memory overhead) as well as supporting features such as semantic predicates and non-greedy operators in a form to support ANTLR's prediction algorithm.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final ArrayList | configs
This is a list of all configs in this set. |
| private ConflictInfo | |
| private boolean | |
| private boolean | |
| private final HashMap | mergedConfigs
This maps (state, alt) -> merged |
| private boolean | outermostConfigSet
When |
| private int | |
| private final ArrayList | unmerged
This is an "overflow" list holding configs which cannot be merged with one
of the configs in |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(ATNConfig
element to be added to this set e)Implements java. |
| public boolean | |
| public boolean | addAll(Collection<? extends ATNConfig>
collection containing elements to be added to this set c)Implements java. |
| public boolean | |
| protected boolean | |
| public void | clear()
Implements java. |
| public void | |
| public ATNConfigSet | |
| public boolean | contains(Object
element whose presence in this set is to be tested o)Implements java. true if this set contains the specified element.
|
| public boolean | containsAll(Collection<?>
collection to be checked for containment in this set c)Implements java. true if this set contains all of the elements of the
specified collection.
|
| protected final void | |
| public boolean | equals(Object
object to be compared for equality with this set obj)Overrides java. Implements java. |
| public ATNConfig | |
| public ConflictInfo | |
| public BitSet | |
| public boolean | |
| protected long | |
| public BitSet | getRepresentedAlternatives()
Get the set of all alternatives represented by configurations in this set. |
| public Set | |
| public int | |
| public int | hashCode()
Overrides java. Implements java. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public final boolean | |
| public Iterator | |
| public void | |
| public void | |
| public boolean | remove(Object
object to be removed from this set, if present o)Implements java. |
| public void | |
| public boolean | removeAll(Collection<?>
collection containing elements to be removed from this set c)Implements java. |
| public boolean | retainAll(Collection<?>
collection containing elements to be retained in this set c)Implements java. |
| public void | |
| public void | |
| public int | |
| public Object[] | toArray()
Implements java. |
| public <T> T[] | toArray(T[]
the array into which the elements of this set are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose. a)Implements java. |
| public String | |
| public String | |
| private void | |
| private void |
| cachedHashCode | back to summary |
|---|---|
| private int cachedHashCode | |
| configs | back to summary |
|---|---|
| private final ArrayList<ATNConfig> configs This is a list of all configs in this set. | |
| conflictInfo | back to summary |
|---|---|
| private ConflictInfo conflictInfo | |
| dipsIntoOuterContext | back to summary |
|---|---|
| private boolean dipsIntoOuterContext | |
| hasSemanticContext | back to summary |
|---|---|
| private boolean hasSemanticContext | |
| mergedConfigs | back to summary |
|---|---|
| private final HashMap<Long, ATNConfig> mergedConfigs This maps (state, alt) -> merged
This map is only used for optimizing the process of adding configs to the set,
and is | |
| outermostConfigSet | back to summary |
|---|---|
| private boolean outermostConfigSet When Note
| |
| uniqueAlt | back to summary |
|---|---|
| private int uniqueAlt | |
| unmerged | back to summary |
|---|---|
| private final ArrayList<ATNConfig> unmerged This is an "overflow" list holding configs which cannot be merged with one
of the configs in
This list is only used for optimizing the process of adding configs to the set,
and is | |
| ATNConfigSet | back to summary |
|---|---|
| public ATNConfigSet() | |
| ATNConfigSet | back to summary |
|---|---|
protected ATNConfigSet(ATNConfigSet set, boolean readonly)
| |
| add | back to summary |
|---|---|
| public boolean add(ATNConfig e) Implements java. Doc from java. Adds the specified element to this set if it is not already present
(optional operation). More formally, adds the specified element
The stipulation above does not imply that sets must accept all
elements; sets may refuse to add any particular element, including
| |
| add | back to summary |
|---|---|
| public boolean add(ATNConfig e, PredictionContextCache contextCache) | |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends ATNConfig> c) Implements java. Doc from java. Adds all of the elements in the specified collection to this set if
they're not already present (optional operation). If the specified
collection is also a set, the
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends ATNConfig> c, PredictionContextCache contextCache) | |
| canMerge | back to summary |
|---|---|
| protected boolean canMerge(ATNConfig left, long leftKey, ATNConfig right) | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Doc from java. Removes all of the elements from this set (optional operation). The set will be empty after this call returns.
| |
| clearExplicitSemanticContext | back to summary |
|---|---|
| public void clearExplicitSemanticContext() | |
| clone | back to summary |
|---|---|
| public ATNConfigSet clone(boolean readonly) | |
| contains | back to summary |
|---|---|
| public boolean contains(Object o) Implements java. Doc from java. Returns | |
| containsAll | back to summary |
|---|---|
| public boolean containsAll(Collection<?> c) Implements java. Doc from java. Returns
| |
| ensureWritable | back to summary |
|---|---|
| protected final void ensureWritable() | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Implements java. Doc from java. Compares the specified object with this set for equality. Returns
| |
| get | back to summary |
|---|---|
| public ATNConfig get(int index) | |
| getConflictInfo | back to summary |
|---|---|
| public ConflictInfo getConflictInfo() | |
| getConflictingAlts | back to summary |
|---|---|
| public BitSet getConflictingAlts() | |
| getDipsIntoOuterContext | back to summary |
|---|---|
| public boolean getDipsIntoOuterContext() | |
| getKey | back to summary |
|---|---|
| protected long getKey(ATNConfig e) | |
| getRepresentedAlternatives | back to summary |
|---|---|
| public BitSet getRepresentedAlternatives() Get the set of all alternatives represented by configurations in this set.
| |
| getStates | back to summary |
|---|---|
| public Set | |
| getUniqueAlt | back to summary |
|---|---|
| public int getUniqueAlt() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set,
where the hash code of a
| |
| hasSemanticContext | back to summary |
|---|---|
| public boolean hasSemanticContext() | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| isExactConflict | back to summary |
|---|---|
| public boolean isExactConflict() | |
| isOutermostConfigSet | back to summary |
|---|---|
| public boolean isOutermostConfigSet() | |
| isReadOnly | back to summary |
|---|---|
| public final boolean isReadOnly() | |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). | |
| markExplicitSemanticContext | back to summary |
|---|---|
| public void markExplicitSemanticContext() | |
| optimizeConfigs | back to summary |
|---|---|
| public void optimizeConfigs(ATNSimulator interpreter) | |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Implements java. Doc from java. Removes the specified element from this set if it is present
(optional operation). More formally, removes an element | |
| remove | back to summary |
|---|---|
| public void remove(int index) | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(Collection<?> c) Implements java. Doc from java. Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.
| |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(Collection<?> c) Implements java. Doc from java. Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.
| |
| setConflictInfo | back to summary |
|---|---|
| public void setConflictInfo(ConflictInfo conflictInfo) | |
| setOutermostConfigSet | back to summary |
|---|---|
| public void setOutermostConfigSet(boolean outermostConfigSet) | |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs. | |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(T[] a) Implements java. Doc from java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set. If this set fits in the specified array with room to spare
(i.e., the array has more elements than this set), the element in
the array immediately following the end of the set is set to
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Like the Suppose
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
| public String toString(boolean showContext) | |
| updatePropertiesForAddedConfig | back to summary |
|---|---|
| private void updatePropertiesForAddedConfig(ATNConfig config) | |
| updatePropertiesForMergedConfig | back to summary |
|---|---|
| private void updatePropertiesForMergedConfig(ATNConfig config) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public ATNConfig | |
| public void | remove()
Overrides default java. |
| index | back to summary |
|---|---|
| pack-priv int index | |
| removed | back to summary |
|---|---|
| pack-priv boolean removed | |
| ATNConfigSetIterator | back to summary |
|---|---|
| private ATNConfigSetIterator() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public ATNConfig next() Implements java. Doc from java. Returns the next element in the iteration. | |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |