public class ATNConfigSet extends java.lang.Object implements java.util.Set<ATNConfig>
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 |
---|---|
static class |
ATNConfigSet.AbstractConfigHashSet |
static class |
ATNConfigSet.ConfigEqualityComparator |
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 |
---|---|
ATNConfigSet.AbstractConfigHashSet |
configLookup
All configs but hashed by (s, i, _, pi) not including context.
|
java.util.ArrayList<ATNConfig> |
configs
Track the elements as they are added to the set; supports get(i)
|
protected java.util.BitSet |
conflictingAlts |
boolean |
dipsIntoOuterContext |
boolean |
fullCtx
Indicates that this configuration set is part of a full context
LL prediction.
|
boolean |
hasSemanticContext |
protected boolean |
readonly
Indicates that the set of configurations is read-only.
|
int |
uniqueAlt |
Constructor and Description |
---|
ATNConfigSet() |
ATNConfigSet(ATNConfigSet old) |
ATNConfigSet(boolean fullCtx) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(ATNConfig config) |
boolean |
add(ATNConfig config,
DoubleKeyMap<PredictionContext,PredictionContext,PredictionContext> mergeCache)
Adding a new config means merging contexts with existing configs for
(s, i, pi, _) , where s is the
ATNConfig.state , i is the ATNConfig.alt , and
pi is the ATNConfig.semanticContext . |
boolean |
addAll(java.util.Collection<? extends ATNConfig> coll) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
containsFast(ATNConfig obj) |
java.util.List<ATNConfig> |
elements()
Return a List holding list of configs
|
boolean |
equals(java.lang.Object o) |
ATNConfig |
get(int i) |
java.util.BitSet |
getAlts()
Gets the complete set of represented alternatives for the configuration
set.
|
java.util.List<SemanticContext> |
getPredicates() |
java.util.Set<ATNState> |
getStates() |
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isReadonly() |
java.util.Iterator<ATNConfig> |
iterator() |
void |
optimizeConfigs(ATNSimulator interpreter) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
void |
setReadonly(boolean readonly) |
int |
size() |
ATNConfig[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
protected boolean readonly
public ATNConfigSet.AbstractConfigHashSet configLookup
public final java.util.ArrayList<ATNConfig> configs
public int uniqueAlt
protected java.util.BitSet conflictingAlts
public boolean hasSemanticContext
public boolean dipsIntoOuterContext
public final boolean fullCtx
public ATNConfigSet(boolean fullCtx)
public ATNConfigSet()
public ATNConfigSet(ATNConfigSet old)
public boolean add(ATNConfig config)
public boolean add(ATNConfig config, DoubleKeyMap<PredictionContext,PredictionContext,PredictionContext> mergeCache)
(s, i, pi, _)
, where s
is the
ATNConfig.state
, i
is the ATNConfig.alt
, and
pi
is the ATNConfig.semanticContext
. We use
(s,i,pi)
as key.
This method updates dipsIntoOuterContext
and
hasSemanticContext
when necessary.
public java.util.List<ATNConfig> elements()
public java.util.Set<ATNState> getStates()
public java.util.BitSet getAlts()
public java.util.List<SemanticContext> getPredicates()
public ATNConfig get(int i)
public void optimizeConfigs(ATNSimulator interpreter)
public boolean addAll(java.util.Collection<? extends ATNConfig> coll)
public boolean equals(java.lang.Object o)
public int hashCode()
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public boolean containsFast(ATNConfig obj)
public java.util.Iterator<ATNConfig> iterator()
public void clear()
public boolean isReadonly()
public void setReadonly(boolean readonly)
public java.lang.String toString()
toString
in class java.lang.Object
public ATNConfig[] toArray()
public <T> T[] toArray(T[] a)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)