# Package-level declarations

## Types

CheckableHandlerHolder
Link copied to clipboard
interface CheckableHandlerHolder < I : State , O : State > : StatesHandler < I , O >

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

CustomizableHandlerHolder
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

DefaultStatesMachine
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.

DefaultUpdatableStatesMachine
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 >
State
Link copied to clipboard
interface State

Represents a state in a finite state machine (FSM). Each state must have an associated context that identifies it uniquely within its chain.

StatesHandler
Link copied to clipboard
fun interface StatesHandler < I : State , O : State >

Default realization of states handler

StatesMachine
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

StatesManager
Link copied to clipboard
interface StatesManager < T : State >
UpdatableStatesMachine
Link copied to clipboard
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

CheckableHandlerHolder
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 >
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 >