onEvent

fun onEvent(event: EventState<E, S>, action: SyncStateAction<C, A, R>?): DslStateMapEventHandler<S, E, C, A, R>

Defines a transition when the state is the currentState and the on is received. The state is changed to the targetState.

Parameters

event

A Pair with the first being the on and the second being the targetState.

action

The action will be performed


fun onEvent(event: EventState<E, S>, guard: StateGuard<C, A>, action: SyncStateAction<C, A, R>?): DslStateMapEventHandler<S, E, C, A, R>

Defines a guarded transition. Where the transition will only be used if the guarded expression is met

Parameters

event

The event and targetState the defines the transition

guard

The guard expression must be met before the transition is considered.

action

The optional action that may be executed


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

Defines a transition where an on causes an action but doesn't change the state.

Parameters

event

The event and targetState the defines the transition

action

The optional action that may be executed


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

Defines a guarded transition where an on causes an action but doesn't change the state and will only be used if the guard expression is met. This will be an internal transition with no change in state.

Parameters

event

The event that will trigger the transition.

guard

The guard expression must be met before the transition is considered.

action

The optional action that may be executed