Class State

  • All Implemented Interfaces:

    public class State
    extends java.lang.Object
    implements java.lang.Comparable<State>
    Automaton state.
    • Field Detail

      • transitionsArray

        public Transition[] transitionsArray
      • numTransitions

        public int numTransitions
    • Constructor Detail

      • State

        public State()
        Constructs a new state. Initially, the new state is a reject state.
    • Method Detail

      • getTransitions

        public java.lang.Iterable<Transition> getTransitions()
        Returns the set of outgoing transitions. Subsequent changes are reflected in the automaton.
        transition set
      • numTransitions

        public int numTransitions()
      • setTransitions

        public void setTransitions​(Transition[] transitions)
      • addTransition

        public void addTransition​(Transition t)
        Adds an outgoing transition.
        t - transition
      • setAccept

        public void setAccept​(boolean accept)
        Sets acceptance for this state.
        accept - if true, this state is an accept state
      • isAccept

        public boolean isAccept()
        Returns acceptance status.
        true is this is an accept state
      • step

        public State step​(int c)
        Performs lookup in transitions, assuming determinism.
        c - codepoint to look up
        destination state, null if no matching outgoing transition
        See Also:
        step(int, Collection)
      • step

        public void step​(int c,
                         java.util.Collection<State> dest)
        Performs lookup in transitions, allowing nondeterminism.
        c - codepoint to look up
        dest - collection where destination states are stored
        See Also:
      • trimTransitionsArray

        public void trimTransitionsArray()
        Downsizes transitionArray to numTransitions
      • reduce

        public void reduce()
        Reduces this state. A state is "reduced" by combining overlapping and adjacent edge intervals with same destination.
      • sortTransitions

        public void sortTransitions​(java.util.Comparator<Transition> comparator)
        Sorts transitions array in-place.
      • getNumber

        public int getNumber()
        Return this state's number.

        Expert: Will be useless unless Automaton.getNumberedStates() has been called first to number the states.

        the number
      • toString

        public java.lang.String toString()
        Returns string describing this state. Normally invoked via Automaton.toString().
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(State s)
        Compares this object with the specified object for order. States are ordered by the time of construction.
        Specified by:
        compareTo in interface java.lang.Comparable<State>
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object