Class State


  • public class State
    extends Object
    The respresentation of a state in a state machine.
    Version:
    $Revision$
    Author:
    Scott.Stark@jboss.org
    • Constructor Detail

      • State

        public State​(String name)
      • State

        public State​(String name,
                     Map transitions)
    • Method Detail

      • getName

        public String getName()
        Get the state name.
        Returns:
        the name of the state.
      • getData

        public Object getData()
      • setData

        public void setData​(Object data)
      • isAcceptState

        public boolean isAcceptState()
        An accept state is indicated by no transitions
        Returns:
        true if this is an accept state, false otherwise.
      • addTransition

        public State addTransition​(Transition transition)
        Add a transition to the allowed transition map.
        Parameters:
        transition -
        Returns:
        this to allow chained addTransition calls
      • getTransition

        public Transition getTransition​(String name)
        Lookup an allowed transition given its name.
        Parameters:
        name - - the name of a valid transition from this state.
        Returns:
        the valid transition if it exists, null otherwise.
      • getTransitions

        public Map getTransitions()
        Get the Map of allowed transitions for this state.
        Returns:
        the allowed transitions map.