ExecutionContext

class ExecutionContext<State : Enum<State>, Event : Enum<Event>, GuardKey : Enum<GuardKey>, ActionKey : Enum<ActionKey>, Memento>

An ExecutionContext represents a running finite state machine. In order to execute a step, it maintains a reference to the executor, the current state, and a client-provided memento which will be passed as the sole argument of every action invocation.

To obtain a new execution context, a client should call StateMachine.createExecutionContext on an established FSM.

To execute a step, a client should call handleEvent with an appropriate event.

Author

Mark van Gulik

Todd L Smith

Parameters

State

The state type.

Event

The event type.

GuardKey

The guard key type.

ActionKey

The action key type.

Memento

The memento type.

machine

The state machine to instantiate as an ExecutionContext.

memento

The object which should be passed to all actions.

Functions

Link copied to clipboard
fun handleEvent(event: Event)

Handle the specified event.

Properties

Link copied to clipboard
var currentState: State? = null

The current state.