Class ATNConfigSet

  • All Implemented Interfaces:
    java.lang.Iterable<ATNConfig>, java.util.Collection<ATNConfig>, java.util.Set<ATNConfig>
    Direct Known Subclasses:
    OrderedATNConfigSet

    public class ATNConfigSet
    extends java.lang.Object
    implements java.util.Set<ATNConfig>
    Specialized Set<ATNConfig> that can track info about the set, with support for combining similar configurations using a graph-structured stack.
    • Field Detail

      • readonly

        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.
      • configLookup

        public ATNConfigSet.AbstractConfigHashSet configLookup
        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

        public final java.util.ArrayList<ATNConfig> configs
        Track the elements as they are added to the set; supports get(i)
      • uniqueAlt

        public int uniqueAlt
      • conflictingAlts

        protected java.util.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().
      • hasSemanticContext

        public boolean hasSemanticContext
      • dipsIntoOuterContext

        public boolean dipsIntoOuterContext
      • fullCtx

        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.
    • Constructor Detail

      • ATNConfigSet

        public ATNConfigSet​(boolean fullCtx)
      • ATNConfigSet

        public ATNConfigSet()
    • Method Detail

      • add

        public boolean add​(ATNConfig config)
        Specified by:
        add in interface java.util.Collection<ATNConfig>
        Specified by:
        add in interface java.util.Set<ATNConfig>
      • elements

        public java.util.List<ATNConfig> elements()
        Return a List holding list of configs
      • getStates

        public java.util.Set<ATNState> getStates()
      • getAlts

        public java.util.BitSet getAlts()
        Gets the complete set of represented alternatives for the configuration set.
        Returns:
        the set of represented alternatives in this configuration set
        Since:
        4.3
      • optimizeConfigs

        public void optimizeConfigs​(ATNSimulator interpreter)
      • addAll

        public boolean addAll​(java.util.Collection<? extends ATNConfig> coll)
        Specified by:
        addAll in interface java.util.Collection<ATNConfig>
        Specified by:
        addAll in interface java.util.Set<ATNConfig>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<ATNConfig>
        Specified by:
        equals in interface java.util.Set<ATNConfig>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<ATNConfig>
        Specified by:
        hashCode in interface java.util.Set<ATNConfig>
        Overrides:
        hashCode in class java.lang.Object
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<ATNConfig>
        Specified by:
        size in interface java.util.Set<ATNConfig>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<ATNConfig>
        Specified by:
        isEmpty in interface java.util.Set<ATNConfig>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<ATNConfig>
        Specified by:
        contains in interface java.util.Set<ATNConfig>
      • containsFast

        public boolean containsFast​(ATNConfig obj)
      • iterator

        public java.util.Iterator<ATNConfig> iterator()
        Specified by:
        iterator in interface java.util.Collection<ATNConfig>
        Specified by:
        iterator in interface java.lang.Iterable<ATNConfig>
        Specified by:
        iterator in interface java.util.Set<ATNConfig>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<ATNConfig>
        Specified by:
        clear in interface java.util.Set<ATNConfig>
      • isReadonly

        public boolean isReadonly()
      • setReadonly

        public void setReadonly​(boolean readonly)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toArray

        public ATNConfig[] toArray()
        Specified by:
        toArray in interface java.util.Collection<ATNConfig>
        Specified by:
        toArray in interface java.util.Set<ATNConfig>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<ATNConfig>
        Specified by:
        toArray in interface java.util.Set<ATNConfig>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<ATNConfig>
        Specified by:
        remove in interface java.util.Set<ATNConfig>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<ATNConfig>
        Specified by:
        containsAll in interface java.util.Set<ATNConfig>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<ATNConfig>
        Specified by:
        retainAll in interface java.util.Set<ATNConfig>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<ATNConfig>
        Specified by:
        removeAll in interface java.util.Set<ATNConfig>