micro_utils.dokka
0.15.1

# UpdatableStatesMachine

interface UpdatableStatesMachine<T : State> : StatesMachine<T>

This extender of StatesMachine interface declare one new function updateChain. Realizations of this interface must be able to perform update of chain in internal StatesManager

## Functions

handleState
Link copied to clipboard
abstract suspend fun StatesMachine<in T>.handleState(state: T): T?

Main handling of state. In case when this state leads to another State and handleState returns not null State it is assumed that chain is not completed.

launchStateHandling
Link copied to clipboard
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T?
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>, onStateHandlingErrorHandler: StateHandlingErrorHandler<T>): T?
start
Link copied to clipboard
abstract fun start(scope: CoroutineScope): Job

Starts handling of States

startChain
Link copied to clipboard
abstract suspend fun startChain(state: T)

Start chain of States witn state

updateChain
Link copied to clipboard
abstract suspend fun updateChain(currentState: T, newState: T)

Update chain with current state equal to currentState with newState. Behaviour of this update preforming in cases when currentState does not exist in StatesManager must be declared inside of realization of StatesManager.update function

## Inheritors

DefaultUpdatableStatesMachine
Link copied to clipboard

## Extensions

holder
Link copied to clipboard
inline fun <I : O, O : State> StatesHandler<I, O>.holder(strict: Boolean = true): CustomizableHandlerHolder<O, O>
inline fun <I : O, O : State> StatesHandler<I, O>.holder(noinline filter: suspend (state: State) -> Boolean): CustomizableHandlerHolder<O, O>