state

fun state(state: T, commandFactory: (StateMachineCommand<T>) -> Command): StateMachineCommand<T>

Adds a new state to the state machine

Is given the StateMachineCommand so that it can call end and setState, if needed.

Return

the StateMachineCommand for use with a Fluent API

Parameters

state

the state to set

commandFactory

a factory that returns a command to run when the current state is the set state


fun state(state: T, command: Command): StateMachineCommand<T>

Adds a new state to the state machine

Return

the StateMachineCommand for use with a Fluent API

Parameters

state

the state to set

command

the command to run when the current state is the set state