Package io.hektor.fsm

Interface Transition<E,S extends Enum<S>,C extends Context,D extends Data>

All Known Implementing Classes:
TransitionImpl

public interface Transition<E,S extends Enum<S>,C extends Context,D extends Data>
This interface represents the transition between two states. When an event is processed by agiven State, it will match that event against all its Transitions and if one matches, the FSM will transition fo the new state. Note: in the current model, a Transition always live in the context of a State and as such, there is no need to keep track of the from state in this class (which is why only getToState() exists)
Author:
jonas@jonasborjesson.com
  • Method Details

    • match

      boolean match(Object event, C ctx, D data)
      See if the given event is matching this transition.
      Parameters:
      event - the event to match agianst this transition.
      Returns:
      true if the event indeed matches, false otherwise.
    • getToState

      S getToState()
      This Transition represents the transition to this particular state. Assuming the event matches of course.
      Returns:
      the to state
    • getGuardLabel

      Optional<Label> getGuardLabel()
    • getAction

      Optional<Consumer<E>> getAction()
      Get the associated action wih this transition, if it exists.
    • getStatefulAction

      Optional<Action<E,C,D>> getStatefulAction()
    • getActionLabel

      Optional<Label> getActionLabel()
    • getEventType

      Class<E> getEventType()
    • getTransformation

      Optional<Function<E,?>> getTransformation()
      Get the transformation associated with this Transition. A transformation may only exists if this is a transition out of a transient state.
      Returns:
      the optional transformation for a Transition out of a transient state.
    • getTransformationLabel

      Optional<Label> getTransformationLabel()
    • acceptVisitor

      void acceptVisitor(FsmVisitor<S,C,D> visitor)