Class AbstractStateMachine<STATE extends State<STATE>,​CONTEXT extends AbstractContext<?>>

    • Constructor Detail

      • AbstractStateMachine

        public AbstractStateMachine​(STATE initialState)
        Initialize the State-Machine and set an initial State.

        TODO Note that for the initialState the StateHandler.onEntry(Object) method is not called in the beginning.

        initialState - the initial State
    • Method Detail

      • getStateHandler

        public abstract StateHandler<STATE,​CONTEXT> getStateHandler​(STATE state)
        Gets the StateHandler for each State.

        This method is called once for every available State during construction of the StateMachine in order to initialize an internal list of StateHandlers.

        state - the State
        the StateHandler for the given State
      • getPreviousState

        public STATE getPreviousState()
        Gets the previously activate State.
        the State
      • getCurrentState

        public STATE getCurrentState()
        Gets the currently activate State.
        the State
      • forceNextState

        public void forceNextState​(STATE state)
        Forcibly change the next State from outside. Use with care!

        Note that transition events will get called.

        state - the next State