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 method is not called in the beginning.

        Parameters:
        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.

        Parameters:
        state - the State
        Returns:
        the StateHandler for the given State
      • getPreviousState

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

        public STATE getCurrentState()
        Gets the currently activate State.
        Returns:
        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.

        Parameters:
        state - the next State