Class StateMachine

  • All Implemented Interfaces:
    Cloneable

    public class StateMachine
    extends Object
    implements Cloneable
    The representation of a finite state machine.
    Version:
    $Revision$
    Author:
    Scott.Stark@jboss.org
    • Constructor Detail

      • StateMachine

        public StateMachine​(Set states,
                            State startState)
        Create a state machine given its states and start state.
        Parameters:
        states - - Set for the state machine
        startState - - the starting state
      • StateMachine

        public StateMachine​(Set states,
                            State startState,
                            String description)
        Create a state machine given its states and start state.
        Parameters:
        states - - Set for the state machine
        startState - - the starting state
        description - - an optional description of the state machine
    • Method Detail

      • clone

        public Object clone()
        Make a copy of the StateMachine maintaining the current state.
        Overrides:
        clone in class Object
        Returns:
        a copy of the StateMachine.
      • getDescription

        public String getDescription()
        Get the state machine description.
        Returns:
        an possibly null description.
      • getCurrentState

        public State getCurrentState()
        Get the current state of the state machine.
        Returns:
        the current state.
      • getStartState

        public State getStartState()
        Get the start state of the state machine.
        Returns:
        the start state.
      • getStates

        public Set getStates()
        Get the states of the state machine.
        Returns:
        the machine states.
      • reset

        public State reset()
        Reset the state machine back to the start state
        Returns:
        the start state