Class StringUnionOperations.State

  • Enclosing class:
    StringUnionOperations

    static final class StringUnionOperations.State
    extends java.lang.Object
    State with char labels on transitions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) boolean is_final
      true if this state corresponds to the end of at least one input sequence.
      (package private) char[] labels
      Labels of outgoing transitions.
      private static char[] NO_LABELS
      An empty set of labels.
      private static StringUnionOperations.State[] NO_STATES
      An empty set of states.
      (package private) StringUnionOperations.State[] states
      States reachable from outgoing transitions.
    • Constructor Summary

      Constructors 
      Constructor Description
      State()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static char[] copyOf​(char[] original, int newLength)
      JDK1.5-replacement of Arrays.copyOf(char[], int)
      static StringUnionOperations.State[] copyOf​(StringUnionOperations.State[] original, int newLength)
      JDK1.5-replacement of Arrays.copyOf(char[], int)
      boolean equals​(java.lang.Object obj)
      Two states are equal if: they have an identical number of outgoing transitions, labeled with the same labels corresponding outgoing transitions lead to the same states (to states with an identical right-language).
      StringUnionOperations.State getState​(char label)
      Returns the target state of a transition leaving this state and labeled with label.
      StringUnionOperations.State[] getStates()
      Returns an array of outgoing transitions from this state.
      char[] getTransitionLabels()
      Returns an array of outgoing transition labels.
      boolean hasChildren()
      Return true if this state has any children (outgoing transitions).
      int hashCode()
      Compute the hash code of the current status of this state.
      boolean isFinal()
      Is this state a final state in the automaton?
      (package private) StringUnionOperations.State lastChild()
      Return the most recent transitions's target state.
      (package private) StringUnionOperations.State lastChild​(char label)
      Return the associated state if the most recent transition is labeled with label.
      (package private) StringUnionOperations.State newState​(char label)
      Create a new outgoing transition labeled label and return the newly created target state for this transition.
      private static boolean referenceEquals​(java.lang.Object[] a1, java.lang.Object[] a2)
      Compare two lists of objects for reference-equality.
      (package private) void replaceLastChild​(StringUnionOperations.State state)
      Replace the last added outgoing transition's target state with the given state.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_LABELS

        private static final char[] NO_LABELS
        An empty set of labels.
      • labels

        char[] labels
        Labels of outgoing transitions. Indexed identically to states. Labels must be sorted lexicographically.
      • is_final

        boolean is_final
        true if this state corresponds to the end of at least one input sequence.
    • Constructor Detail

      • State

        State()
    • Method Detail

      • getState

        public StringUnionOperations.State getState​(char label)
        Returns the target state of a transition leaving this state and labeled with label. If no such transition exists, returns null.
      • getTransitionLabels

        public char[] getTransitionLabels()
        Returns an array of outgoing transition labels. The array is sorted in lexicographic order and indexes correspond to states returned from getStates().
      • getStates

        public StringUnionOperations.State[] getStates()
        Returns an array of outgoing transitions from this state. The returned array must not be changed.
      • equals

        public boolean equals​(java.lang.Object obj)
        Two states are equal if:
        • they have an identical number of outgoing transitions, labeled with the same labels
        • corresponding outgoing transitions lead to the same states (to states with an identical right-language).
        Overrides:
        equals in class java.lang.Object
      • hasChildren

        public boolean hasChildren()
        Return true if this state has any children (outgoing transitions).
      • isFinal

        public boolean isFinal()
        Is this state a final state in the automaton?
      • hashCode

        public int hashCode()
        Compute the hash code of the current status of this state.
        Overrides:
        hashCode in class java.lang.Object
      • newState

        StringUnionOperations.State newState​(char label)
        Create a new outgoing transition labeled label and return the newly created target state for this transition.
      • lastChild

        StringUnionOperations.State lastChild​(char label)
        Return the associated state if the most recent transition is labeled with label.
      • replaceLastChild

        void replaceLastChild​(StringUnionOperations.State state)
        Replace the last added outgoing transition's target state with the given state.
      • copyOf

        private static char[] copyOf​(char[] original,
                                     int newLength)
        JDK1.5-replacement of Arrays.copyOf(char[], int)
      • referenceEquals

        private static boolean referenceEquals​(java.lang.Object[] a1,
                                               java.lang.Object[] a2)
        Compare two lists of objects for reference-equality.