Package-level declarations

Types

Link copied to clipboard

Define checkable holder which can be used to precheck that this handler may handle incoming State

Link copied to clipboard
class CustomizableHandlerHolder<I : O, O : State>(delegateTo: StatesHandler<I, O>, filter: suspend (state: O) -> Boolean) : CheckableHandlerHolder<I, O>

Default realization of StatesHandler. It will incapsulate checking of State type in checkHandleable and class casting in handleState

Link copied to clipboard
open class DefaultStatesMachine<T : State>(statesManager: StatesManager<T>, handlers: List<CheckableHandlerHolder<in T, T>>, onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()) : StatesMachine<T>

Default realization of StatesMachine. It uses statesManager for incapsulation of States storing and contexts resolving, and uses launchStateHandling for State handling.

Link copied to clipboard
open class DefaultUpdatableStatesMachine<T : State>(statesManager: StatesManager<T>, handlers: List<CheckableHandlerHolder<in T, T>>, onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()) : DefaultStatesMachine<T> , UpdatableStatesMachine<T>
Link copied to clipboard
interface State
Link copied to clipboard
fun interface StatesHandler<I : State, O : State>

Default realization of states handler

Link copied to clipboard
interface StatesMachine<T : State> : StatesHandler<T, T>

Default StatesMachine may startChain and use inside logic for handling States. By default you may use DefaultStatesMachine or build it with dev.inmo.micro_utils.fsm.common.dsl.buildFSM. Implementers MUST NOT start handling until start method will be called

Link copied to clipboard
interface StatesManager<T : State>
Link copied to clipboard

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

Link copied to clipboard
inline fun <I : O, O : State> CheckableHandlerHolder(strict: Boolean = false, delegateTo: StatesHandler<I, O>): CustomizableHandlerHolder<O, O>
fun <I : O, O : State> CheckableHandlerHolder(inputKlass: KClass<I>, strict: Boolean = false, delegateTo: StatesHandler<I, O>): CustomizableHandlerHolder<O, O>
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>