Set<ATNConfig> that can track
info about the set, with support for combining similar configurations using a
graph-structured stack.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | |
| public static class | |
| public static class | ATNConfigSet.ConfigHashSet
The reason that we need this is because we don't want the hash map to use the standard hash code and equals. |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| public ATNConfigSet. | configLookup
All configs but hashed by (s, i, _, pi) not including context. |
| public final ArrayList | configs
Track the elements as they are added to the set; supports get(i) |
| protected BitSet | conflictingAlts
Currently this is only used when we detect SLL conflict; this does not necessarily represent the ambiguous alternatives. |
| public boolean | |
| public final boolean | fullCtx
Indicates that this configuration set is part of a full context LL prediction. |
| public boolean | |
| protected boolean | readonly
Indicates that the set of configurations is read-only. |
| public int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(ATNConfig
element to be added to this set config)Implements java. |
| public boolean | add(ATNConfig config, DoubleKeyMap<PredictionContext, PredictionContext, PredictionContext> mergeCache)
Adding a new config means merging contexts with existing configs for
|
| public boolean | addAll(Collection<? extends ATNConfig>
collection containing elements to be added to this set coll)Implements java. |
| public void | clear()
Implements java. |
| 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.
|
| public boolean | |
| public List | |
| public boolean | equals(Object
object to be compared for equality with this set o)Overrides java. Implements java. |
| public ATNConfig | |
| public BitSet | Returns: the set of represented alternatives in this configuration setGets the complete set of represented alternatives for the configuration set. |
| public List | |
| public Set | |
| public int | hashCode()
Overrides java. Implements java. |
| public boolean | |
| public boolean | |
| public Iterator | |
| public void | |
| public boolean | remove(Object
object to be removed from this set, if present o)Implements java. |
| 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 int | |
| public ATNConfig[] | 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 |
| cachedHashCode | back to summary |
|---|---|
| private int cachedHashCode | |
| configLookup | back to summary |
|---|---|
| public ATNConfigSet. All configs but hashed by (s, i, _, pi) not including context. Wiped out when we go readonly as this set becomes a DFA state. | |
| configs | back to summary |
|---|---|
| public final ArrayList<ATNConfig> configs Track the elements as they are added to the set; supports get(i) | |
| conflictingAlts | back to summary |
|---|---|
| protected BitSet conflictingAlts Currently this is only used when we detect SLL conflict; this does not necessarily represent the ambiguous alternatives. In fact, I should also point out that this seems to include predicated alternatives that have predicates that evaluate to false. Computed in computeTargetState(). | |
| dipsIntoOuterContext | back to summary |
|---|---|
| public boolean dipsIntoOuterContext | |
| fullCtx | back to summary |
|---|---|
| public final boolean fullCtx Indicates that this configuration set is part of a full context LL prediction. It will be used to determine how to merge $. With SLL it's a wildcard whereas it is not for LL context merge. | |
| hasSemanticContext | back to summary |
|---|---|
| public boolean hasSemanticContext | |
| readonly | back to summary |
|---|---|
| protected boolean readonly Indicates that the set of configurations is read-only. Do not allow any code to manipulate the set; DFA states will point at the sets and they must not change. This does not protect the other fields; in particular, conflictingAlts is set after we've made this readonly. | |
| uniqueAlt | back to summary |
|---|---|
| public int uniqueAlt | |
| ATNConfigSet | back to summary |
|---|---|
| public ATNConfigSet(boolean fullCtx) | |
| ATNConfigSet | back to summary |
|---|---|
| public ATNConfigSet() | |
| ATNConfigSet | back to summary |
|---|---|
| public ATNConfigSet(ATNConfigSet old) | |
| add | back to summary |
|---|---|
| public boolean add(ATNConfig config) 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 config, DoubleKeyMap<PredictionContext, PredictionContext, PredictionContext> mergeCache) Adding a new config means merging contexts with existing configs for
This method updates | |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends ATNConfig> coll) 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
| |
| 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.
| |
| 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
| |
| containsFast | back to summary |
|---|---|
| public boolean containsFast(ATNConfig obj) | |
| elements | back to summary |
|---|---|
| public List Return a List holding list of configs | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) 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 i) | |
| getAlts | back to summary |
|---|---|
| public BitSet getAlts() Gets the complete set of represented alternatives for the configuration set.
| |
| getPredicates | back to summary |
|---|---|
| public List | |
| getStates | back to summary |
|---|---|
| public Set | |
| 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
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| isReadonly | back to summary |
|---|---|
| public 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). | |
| 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 | |
| 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.
| |
| setReadonly | back to summary |
|---|---|
| public void setReadonly(boolean readonly) | |
| 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 ATNConfig[] 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. | |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractConfigHashSet(AbstractEqualityComparator<? super ATNConfig> comparator, int initialCapacity, int initialBucketCapacity)
|
| Modifier and Type | Method and Description |
|---|---|
| protected final ATNConfig | asElementType(Object
the object to try and cast to the element type of the set o)Overrides org. o as an instance of the element type T.
|
| protected final ATNConfig[] | createBucket(int
the length of the array to return capacity)Overrides org. T with length capacity.
|
| protected final ATNConfig[][] | createBuckets(int
the length of the array to return capacity)Overrides org. T[] with length capacity.
|
| AbstractConfigHashSet | back to summary |
|---|---|
| public AbstractConfigHashSet(AbstractEqualityComparator<? super ATNConfig> comparator) | |
| AbstractConfigHashSet | back to summary |
|---|---|
| public AbstractConfigHashSet(AbstractEqualityComparator<? super ATNConfig> comparator, int initialCapacity, int initialBucketCapacity) | |
| asElementType | back to summary |
|---|---|
| protected final ATNConfig asElementType(Object o) Overrides org. Doc from org. Return | |
| createBucket | back to summary |
|---|---|
| protected final ATNConfig[] createBucket(int capacity) Overrides org. Doc from org. Return an array of | |
| createBuckets | back to summary |
|---|---|
| protected final ATNConfig[][] createBuckets(int capacity) Overrides org. Doc from org. Return an array of | |
| Modifier and Type | Field and Description |
|---|---|
| public static final ATNConfigSet. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(ATNConfig
The first object to compare. a, ATNConfig The second object to compare. b)Implements org. |
| public int | hashCode(ATNConfig
The object. o)Implements org. |
| INSTANCE | back to summary |
|---|---|
| public static final ATNConfigSet. | |
| ConfigEqualityComparator | back to summary |
|---|---|
| private ConfigEqualityComparator() | |
| equals | back to summary |
|---|---|
| public boolean equals(ATNConfig a, ATNConfig b) Implements org. Doc from org. This method tests if two objects are equal. | |
| hashCode | back to summary |
|---|---|
| public int hashCode(ATNConfig o) Implements org. Doc from org. This method returns a hash code for the specified object. | |
(s,i,_,semctx) to be equal. Unfortunately, this key effectively doubles
the number of objects associated with ATNConfigs. The other solution is to
use a hash table that lets us specify the equals/hashcode operation.
| Access | Constructor and Description |
|---|---|
| public |
| ConfigHashSet | back to summary |
|---|---|
| public ConfigHashSet() | |