Class AbstractTransition

    • Field Detail

      • eventId

        private final java.lang.Object eventId
        The accepted event ID
      • nextState

        private final State nextState
        The next state, if any
    • Constructor Detail

      • AbstractTransition

        public AbstractTransition​(java.lang.Object eventId)
        Creates a new instance which will loopback to the same State for the specified Event id.
        Parameters:
        eventId - the Event id.
      • AbstractTransition

        public AbstractTransition​(java.lang.Object eventId,
                                  State nextState)
        Creates a new instance with the specified State as next state and for the specified Event id.
        Parameters:
        eventId - the Event id.
        nextState - the next State.
      • AbstractTransition

        public AbstractTransition​(State nextState)
        Creates a new instance with the specified State as next state and for the wild card Event id.
        Parameters:
        nextState - the next State.
      • AbstractTransition

        public AbstractTransition()
        Creates a new instance with a reflexive State as next state and for the wild card Event id.
    • Method Detail

      • execute

        public boolean execute​(Event event)
        Executes this Transition. It is the responsibility of this Transition to determine whether it actually applies for the specified Event. If this Transition doesn't apply nothing should be executed and false must be returned. The method will accept any Event if it is registered with the wild card event ID ('*'), and the event ID it is declared for (ie, the event ID that has been passed as a parameter to this transition constructor.)
        Specified by:
        execute in interface Transition
        Parameters:
        event - the current Event.
        Returns:
        true if the Transition was executed, false otherwise.
      • doExecute

        protected abstract boolean doExecute​(Event event)
        Executes this Transition. This method doesn't have to check if the Event's id matches because execute(Event) has already made sure that that is the case.
        Parameters:
        event - the current Event.
        Returns:
        true if the Transition has been executed successfully and the StateMachine should move to the next State. false otherwise.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object