transition

fun transition(startState: S, event: E, targetState: S, guard: StateGuard<C, A>, action: SyncStateAction<C, A, R>?)

This function defines a transition from the currentState equal to startState to the targetState when event is received and the guard expression is met. The action is executed after any exit action and before entry actions.

Parameters

startState

The transition will be considered when currentState matches stateState

event

The event will trigger the consideration of this transition

targetState

The transition will change currentState to targetState after executing the option action

guard

The guard expression will have to be met to consider the transition

action

The optional action will be executed when the transition occurs.


fun transition(startState: S, event: E, guard: StateGuard<C, A>, action: SyncStateAction<C, A, R>?)

This function defines a transition that doesn't change the state also know as an internal transition. The transition will only occur if the guard expression is met.

Parameters

startState

The transition will be considered when currentState matches stateState

event

The event will trigger the consideration of this transition

guard

The guard expression will have to be met to consider the transition

action

The optional action will be executed when the transition occurs.


fun transition(startState: S, event: E, targetState: S, action: SyncStateAction<C, A, R>?)

This function defines a transition that will be triggered when the currentState is the same as the startState and on is received. The FSM currentState will change to the targetState after the action was executed. Entry and Exit actions will also be performed.

Parameters

startState

transition applies when FSM currentState is the same as stateState.

event

transition applies when on received.

targetState

FSM will transition to targetState.

action

The actions will be invoked


fun transition(startState: S, event: E, action: SyncStateAction<C, A, R>?)

This function defines a transition that doesn't change the state of the state machine when the currentState is startState and the on is received and after the action was performed. No entry or exit actions performed.

Parameters

startState

transition applies when when FSM currentState is the same as stateState

event

transition applies when on received

action

actions will be invoked