Class CountingState

  • All Implemented Interfaces:
    State

    public class CountingState
    extends java.lang.Object
    implements State
    A counting state is a dynamic object representing the combination of an AutomatonState and a counter value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.util.Iterator<Edge> getEdges()
      Get an iterator over all the transitions (edges) allowed from this state
      Edge getTransition​(int token, UserComplexType type)
      Find the edge representing the transition from this state to another state, that is triggered by a given input token
      AutomatonState getUnderlyingState()  
      Edge[] getWildcardEdges()
      Get an iterator over the wildcard transitions (edges) allowed from this state.
      int hashCode()  
      State incrementCounter()  
      boolean isFinalState()
      Ask whether this state is a valid final state, that is, no further transitions are needed to complete a successful path through the finite state machine
      java.lang.CharSequence listAllowedElements()
      Construct a human-readable message explaining what elements are permitted as transitions from this state
      void testMinimumReached()  
      • Methods inherited from class java.lang.Object

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

      • CountingState

        public CountingState​(AutomatonState as,
                             int startFrom)
    • Method Detail

      • getTransition

        public Edge getTransition​(int token,
                                  UserComplexType type)
        Description copied from interface: State
        Find the edge representing the transition from this state to another state, that is triggered by a given input token
        Specified by:
        getTransition in interface State
        Parameters:
        token - the input token, specifically the fingerprint of an element name
        type - the complex type whose content model we are validating against
        Returns:
        the Edge representing the selected transition of the finite state machine, or null if this token is not accepted when in this State (which implies a validation error).
      • isFinalState

        public boolean isFinalState()
        Description copied from interface: State
        Ask whether this state is a valid final state, that is, no further transitions are needed to complete a successful path through the finite state machine
        Specified by:
        isFinalState in interface State
        Returns:
        true if this is a valid final state
      • listAllowedElements

        public java.lang.CharSequence listAllowedElements()
        Description copied from interface: State
        Construct a human-readable message explaining what elements are permitted as transitions from this state
        Specified by:
        listAllowedElements in interface State
        Returns:
        A message indicating what elements may come next
      • getWildcardEdges

        public Edge[] getWildcardEdges()
        Get an iterator over the wildcard transitions (edges) allowed from this state.
        Specified by:
        getWildcardEdges in interface State
        Returns:
        an Iterator over the edges that represent element wildcards. The objects returned by this Iterator are Edge objects.
      • getEdges

        public java.util.Iterator<Edge> getEdges()
        Get an iterator over all the transitions (edges) allowed from this state
        Specified by:
        getEdges in interface State
        Returns:
        an Iterator over all the edges from this state. The objects returned by this Iterator are Edge objects.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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