Class StateMachine


  • public class StateMachine
    extends Object
    The State Machine.
    • Method Detail

      • changeState

        public boolean changeState​(StateVertex nextState)
        Change the currentState to the nextState if possible. The next state should already be present in the graph.
        Parameters:
        nextState - the next state.
        Returns:
        true if currentState is successfully changed.
      • addStateToCurrentState

        private StateVertex addStateToCurrentState​(StateVertex newState,
                                                   Eventable eventable)
        Adds the newState and the edge between the currentState and the newState on the SFG.
        Parameters:
        newState - the new state.
        eventable - the clickable causing the new state.
        Returns:
        the clone state iff newState is a clone, else returns null
      • getCurrentState

        public StateVertex getCurrentState()
        Return the current State in this state machine.
        Returns:
        the current State.
      • setCurrentState

        public void setCurrentState​(StateVertex currentState)
      • rewind

        public void rewind()
        reset the state machine to the initial state.
      • switchToStateAndCheckIfClone

        public boolean switchToStateAndCheckIfClone​(Eventable event,
                                                    StateVertex newState,
                                                    CrawlerContext context)
        Adds an edge between the current and new state.
        Returns:
        true if the new state is not found in the state machine.
      • runOnInvariantViolationPlugins

        public void runOnInvariantViolationPlugins​(CrawlerContext context)