Interface State

All Known Implementing Classes:
StateImpl

public interface State
This interface must be implemented by any class that is used as a state in a FSM. The FSM only needs the identity of this object, so all that is really needs is the default equals implementation. The toString() method should also be overridden to give a concise description or name of the state. The StateImpl class handles this.

Pre- and post- actions are taken only on completed transitions between different states. Assume that the FSM is in state A, and the FSM will transition to state B under input I with action X. If A != B and X completes successfully, then after X completes execution, A.postAction is executed, followed by B.preAction.

Author:
Ken Cavanaugh
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method that defines action that occurs whenever this state is exited.
    void
    Method that defines action that occurs whenever this state is entered.
  • Method Details

    • preAction

      void preAction(FSM fsm)
      Method that defines action that occurs whenever this state is entered. Any exceptions thrown by this method are ignored.
    • postAction

      void postAction(FSM fsm)
      Method that defines action that occurs whenever this state is exited. Any exceptions thrown by this method are ignored.