Class State

java.lang.Object
org.glassfish.pfl.basic.fsm.NameBase
org.glassfish.pfl.basic.fsm.State

public class State extends NameBase
Base class for all states in a StateEngine. This must be used as the base class for all states in transitions added to a StateEngine.
  • Constructor Details

  • Method Details

    • getKind

      public State.Kind getKind()
      Return the Kind of this state.
    • preAction

      public FSM preAction(FSM fsm)
      Method that defines action that occurs whenever this state is entered from a different state. preAction is not called on a self-transition. If preAction returns a non-null result, the result becomes the current FSM.

      Any exceptions except ThreadDeath thrown by this method are ignored. This method can be overridden in a state implementation if needed.

    • returnAction

      public State returnAction(FSM fsm, FSM nestedFSM)
      If this state has Kind REFERENCE, and its preAction pushes a nested FSM onto the stack, the returnAction method is called after the nested FSM reaches a final state. The nested FSM is passed into nestedFSM, and fsm is the new top of stack, which is the FSM that was active when the preAction was called. The result is the new state that will be assumed after this REFERENCE's state postAction method is called.

      If the returnAction method sets the state to a new state, the postAction method is called as usuTransition.

      Any exceptions except ThreadDeath thrown by this method are ignored. This method can be overridden in a state implementation if needed.

    • postAction

      public void postAction(FSM fsm)
      Method that defines action that occurs whenever this state is exited, that is, when the state is changed from this state to a new state.

      Any exceptions except ThreadDeath thrown by this method are ignored. This method can be overridden in a state implementation if needed.

    • getDefaultNextState

      public State getDefaultNextState()
      Return the default next state for this state. This is the next state if the input is not found in the action map.
    • getDefaultAction

      public Action getDefaultAction()
      Get the default transition action that is used if the default next state is used.
    • getInputMap

      public Map<Input,Set<Transition>> getInputMap()