Class FSMImpl

java.lang.Object
org.glassfish.pfl.basic.fsm.FSMImpl
All Implemented Interfaces:
FSM

public class FSMImpl extends Object implements FSM
This is the main class that represents an instance of a state machine using a state engine. It may be used as a base class, in which case the guards and actions have access to the derived class. Note that this is optional; an FSM implementation may directly implement the FSM interface if desired.
  • Field Details

    • parent

      private FSM parent
    • state

      private State state
    • stateEngine

      private StateEngine stateEngine
  • Constructor Details

  • Method Details

    • getParent

      public FSM getParent()
      Description copied from interface: FSM
      Get the parent state machine.
      Specified by:
      getParent in interface FSM
    • setParent

      public void setParent(FSM fsm)
      Description copied from interface: FSM
      Set the parent state machine.
      Specified by:
      setParent in interface FSM
    • getStateEngine

      public StateEngine getStateEngine()
      Description copied from interface: FSM
      Return the state engine used to create this FSM.
      Specified by:
      getStateEngine in interface FSM
    • getState

      public State getState()
      Return the current state.
      Specified by:
      getState in interface FSM
    • setState

      public void setState(State nextState)
      Description copied from interface: FSM
      Set the current state of this FSM. May not be called inside a transition action, or from a State method. Only here for use by the StateEngine.
      Specified by:
      setState in interface FSM