AsyncStateMapBuilder

class AsyncStateMapBuilder<S, E, C, A, R>(val validStates: Set<S>, val name: String? = null, val parentBuilder: AsyncStateMachineBuilder<S, E, C, A, R>)

Constructors

Link copied to clipboard
constructor(validStates: Set<S>, name: String? = null, parentBuilder: AsyncStateMachineBuilder<S, E, C, A, R>)

Properties

Link copied to clipboard
val name: String? = null

The name of the statemap.

Link copied to clipboard

The parent state machine builder

Link copied to clipboard

The set of states the state map supports

Functions

Link copied to clipboard
fun automatic(startState: S, targetState: S, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)
Link copied to clipboard
fun automaticPop(startState: S, targetMap: String?, targetState: S?, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Create an automatic pop transition when currentState is startState and when guard is true. The transition will target targetMap and targetState

Link copied to clipboard
fun automaticPush(startState: S, targetMap: String, targetState: S, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Creates an automatic push transition for startState. When the currentState is startState and guard is true the targetMap and targetState will become current after executing the optional action

Link copied to clipboard
fun default(event: E, action: AsyncStateAction<C, A, R>?)

This function defines an action to be invoked when no transitions are found for given event.

fun default(currentState: S, action: DefaultAsyncStateAction<C, S, E, A, R>)

This function defines an action to be invoked when no transitions are found matching the given state and on.

fun default(event: EventState<E, S>, action: AsyncStateAction<C, A, R>?)

This function defines an action to be invoked when no transitions match the event. The currentState will be changed to second parameter of the Pair.

Link copied to clipboard

This function defines an action to be invoked when no action is found matching the current state and event. This will be an internal transition and will not cause a change in state or invoke entry or exit functions.

Link copied to clipboard

This function defines an action to be invoked when no entry action is defined for the current state.

Link copied to clipboard

This function defines an action to be invoked when no exit action is defined for the current state.

Link copied to clipboard
fun entry(currentState: S, action: DefaultEntryExitAction<C, S, A>)

This function defines an action to be invoked when the FSM changes to the provided state

Link copied to clipboard
fun exit(currentState: S, action: DefaultEntryExitAction<C, S, A>)

This function defines an action to be invoked when the FSM changes from the provided state

Link copied to clipboard
fun invariant(message: String, condition: Condition<C>)

This function defines an invariant condition that will hold true before and after all transitions.

Link copied to clipboard
fun popTransition(startState: S, event: E, targetState: S?, targetMap: String?, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Creates a pop transition that applies to the startState on a given event. This will result in a new push transition if the guard expression is true

Link copied to clipboard
fun pushTransition(startState: S, event: E, targetMap: String, targetState: S, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Creates a push transition for a startState and triggered by event and guard expression being true. The transition will change to targetMap and targetState.

Link copied to clipboard
fun timeout(startState: S, targetState: S, timeout: C.() -> Long, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)
Link copied to clipboard
fun timeoutPop(startState: S, targetMap: String?, targetState: S?, timeout: C.() -> Long, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Create an automatic pop transition when currentState is startState and when guard is true. The transition will target targetMap and targetState

Link copied to clipboard
fun timeoutPush(startState: S, targetMap: String, targetState: S, timeout: C.() -> Long, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

Creates an automatic push transition for startState. When the currentState is startState and guard is true the targetMap and targetState will become current after executing the optional action

Link copied to clipboard
fun toMap(afterStateChangeAction: AsyncStateChangeAction<C, S>?): AsyncStateMapDefinition<S, E, C, A, R>

Creates a StateMapDefinition from the data in this builder

Link copied to clipboard
fun transition(startState: S, event: E, targetState: S?, guard: StateGuard<C, A>?, action: AsyncStateAction<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.