AsyncStateMachineBuilder

class AsyncStateMachineBuilder<S, E, C, A, R>(validMapStates: Set<S>, validEvents: Set<E>)

Constructors

Link copied to clipboard
constructor(validMapStates: Set<S>, validEvents: Set<E>)

Properties

Link copied to clipboard

Functions

Link copied to clipboard

This function will set an action that will be invoked when the state has changed and transition is complete. This will be invoked after onEntry and onExit handlers.

Link copied to clipboard

This function enables completed for the state machine definition prevent further changes to the state machine behaviour.

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 initialState(init: StateQuery<C, S>)

This function is used to provide a method for determining the initial state of the FSM using the provided content.

Link copied to clipboard

This function is used to provide a method for determining the initial state of the FSM in cases where there may be one or more named statemaps. In this case the state may be a stack or name / value pairs representing the map name and pushed 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

This function can be used to define a new state machine.

Link copied to clipboard
fun stateMap(name: String, validStates: Set<S>): AsyncStateMapBuilder<S, E, C, A, R>

This function will be used to define a named statemap.

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

This function defines a transition that doesn't change the state of the state machine when the currentState is startState and the on is received and after the action was performed. No entry or exit actions performed.

fun transition(startState: S, event: E, targetState: S, action: AsyncStateAction<C, A, R>?)

This function defines a transition that will be triggered when the currentState is the same as the startState and on is received. The FSM currentState will change to the targetState after the action was executed. Entry and Exit actions will also be performed.

fun transition(startState: S, event: E, guard: StateGuard<C, A>, action: AsyncStateAction<C, A, R>?)

This function defines a transition that doesn't change the state also known as an internal transition. The transition will only occur if the guard expression is met.

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.