DefaultBehaviourContextWithFSM

class DefaultBehaviourContextWithFSM<T>(behaviourContext: <Error class: unknown class>, statesManager: <Error class: unknown class><T>, handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>, fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null, val stateInitialAction: <Error class: unknown class><BehaviourContextWithFSM<T>, Unit, T> = {}, onStateHandlingErrorHandler: <Error class: unknown class><T> = defaultStateHandlingErrorHandler()) : BehaviourContextWithFSM<T>

Default realization of BehaviourContextWithFSM. It uses behaviourContext as a base for this object as BehaviourContext, but managing substates contexts updates for avoiding of updates lost between states

Parameters

onStateHandlingErrorHandler

Will be used in case if state handling has not been successfully completed in launchStateHandling

Constructors

Link copied to clipboard
constructor(behaviourContext: <Error class: unknown class>, statesManager: <Error class: unknown class><T>, handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>, fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null, stateInitialAction: <Error class: unknown class><BehaviourContextWithFSM<T>, Unit, T> = {}, onStateHandlingErrorHandler: <Error class: unknown class><T> = defaultStateHandlingErrorHandler())

Properties

Link copied to clipboard
open override val stateInitialAction: <Error class: unknown class><BehaviourContextWithFSM<T>, Unit, T>

Will be called BEFORE handling of State will be started

Functions

Link copied to clipboard
open override fun <I : T> add(kClass: KClass<I>, strict: Boolean, handler: BehaviourWithFSMStateHandler<I, T>)

Add NON STRICT handler to list of available in future BehaviourContextWithFSM. Non strict means that for input State will be used KClass.isInstance and any inheritor of kClass will pass this requirement

Link copied to clipboard
open fun <I : T> addStrict(kClass: KClass<I>, handler: BehaviourWithFSMStateHandler<I, T>)

Add STRICT handler to list of available in future BehaviourContextWithFSM. Strict means that for input State will be used State::class == kClass and any State with exactly the same type will pass requirements

Link copied to clipboard
open override fun copy(bot: <Error class: unknown class>, scope: CoroutineScope, broadcastChannelsSize: Int, onBufferOverflow: BufferOverflow, upstreamUpdatesFlow: Flow<<Error class: unknown class>>?, triggersHolder: <Error class: unknown class>, subcontextInitialAction: <Error class: unknown class><<Error class: unknown class>, Unit, <Error class: unknown class>>): DefaultBehaviourContextWithFSM<T>
open override fun copy(bot: <Error class: unknown class>, scope: CoroutineScope, broadcastChannelsSize: Int, onBufferOverflow: BufferOverflow, upstreamUpdatesFlow: Flow<<Error class: unknown class>>?, subcontextInitialAction: <Error class: unknown class><<Error class: unknown class>, Unit, <Error class: unknown class>>, triggersHolder: <Error class: unknown class>, stateInitialAction: <Error class: unknown class><BehaviourContextWithFSM<T>, Unit, T>, onStateHandlingErrorHandler: <Error class: unknown class><T>): BehaviourContextWithFSM<T>
Link copied to clipboard
Link copied to clipboard
open suspend fun <Error class: unknown class><in T>.handleState(state: T): T?
Link copied to clipboard
open suspend fun launchStateHandling(state: T, handlers: List<<Error class: unknown class><in T, T>>): T?
Link copied to clipboard

Add NON STRICT handler to list of available in future BehaviourContextWithFSM. Non strict means that for input State will be used KClass.isInstance and any inheritor of I::class will pass this requirement

Link copied to clipboard

Add NON STRICT handler to list of available in future BehaviourContextWithFSM. Non strict means that for input State will be used KClass.isInstance and any inheritor of I::class will pass this requirement

Link copied to clipboard
open suspend fun start(): <Error class: unknown class>
open fun start(scope: CoroutineScope): Job
Link copied to clipboard
open suspend fun startChain(state: T)
Link copied to clipboard
inline fun <I : T> strictlyOn(handler: BehaviourWithFSMStateHandler<I, T>)

Add STRICT handler to list of available in future BehaviourContextWithFSM. Strict means that for input State will be used State::class == I::class and any State with exactly the same type will pass requirements

Link copied to clipboard

Add STRICT handler to list of available in future BehaviourContextWithFSM. Strict means that for input State will be used State::class == I::class and any State with exactly the same type will pass requirements