AsyncStateMachineDefinition

class AsyncStateMachineDefinition<S, E, C, A, R>(val defaultInitialState: S?, deriveInitialState: StateQuery<C, S>?, deriveInitialMap: StateMapQuery<C, S>?, val defaultStateMap: AsyncStateMapDefinition<S, E, C, A, R>, val namedStateMaps: Map<String, AsyncStateMapDefinition<S, E, C, A, R>>)

Constructors

Link copied to clipboard
constructor(defaultInitialState: S?, deriveInitialState: StateQuery<C, S>?, deriveInitialMap: StateMapQuery<C, S>?, defaultStateMap: AsyncStateMapDefinition<S, E, C, A, R>, namedStateMaps: Map<String, AsyncStateMapDefinition<S, E, C, A, R>>)

Properties

Link copied to clipboard
Link copied to clipboard

The top level state map will be created when the state machine is created.

Link copied to clipboard

The named state maps can be accessed via a push transition.

Functions

Link copied to clipboard
fun create(context: C, coroutineScope: CoroutineScope, initial: S? = null): AsyncStateMachineInstance<S, E, C, A, R>

This function will create a state machine instance and set it to the initial state.

fun create(context: C, coroutineScope: CoroutineScope, initialExternalState: ExternalState<S>): AsyncStateMachineInstance<S, E, C, A, R>

This function will create a state machine instance and set it to the state to a previously externalised state.

Link copied to clipboard
fun possibleEvents(state: S, includeDefault: Boolean): Set<E>

This function will provide a list of possible events given a specific state. The actual events may fail because of guard conditions or named state maps and the default state map behaviour being different.