Interface Transition

All Known Implementing Classes:
AbstractTransition, MethodTransition, NoopTransition

public interface Transition
The interface implemented by classes which need to react on transitions between states. A Transition must implement two methods
  • execute : a method called when we process the transition
  • getNextState : a method that gives the next state for this transition
Each Transition accepts two parameters :
  • An event ID : this defines the event this transition will accept
  • A next state
The event ID might be '*', which means the transition will accept any event. The next state can be null, which means teh next state is the current state.
  • Method Details

    • execute

      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.)
      Parameters:
      event - the current Event.
      Returns:
      true if the Transition was executed, false otherwise.
    • getNextState

      State getNextState()
      Returns:
      the State which the StateMachine should move to if this Transition is taken and execute(Event) returns true. null if this Transition is a loopback Transition.