DefaultUpdatableStatesMachine

open class DefaultUpdatableStatesMachine<T : State>(    statesManager: StatesManager<T>,     handlers: List<CheckableHandlerHolder<in T, T>>,     onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()) : DefaultStatesMachine<T> , UpdatableStatesMachine<T>

Constructors

Link copied to clipboard
fun <T : State> DefaultUpdatableStatesMachine(    statesManager: StatesManager<T>,     handlers: List<CheckableHandlerHolder<in T, T>>,     onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler())

Functions

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

Will call launchStateHandling for state handling

Link copied to clipboard
open suspend override 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?
Link copied to clipboard
open suspend override fun performStateUpdate(    previousState: Optional<T>,     actualState: T,     scope: CoroutineScope)

Realization of this update will use the Job of previousState in statesJobs and jobsStates if previousState is Optional.presented and shouldReplaceJob has returned true for previousState and actualState. In other words, Job of previousState WILL NOT be replaced with the new one if they are "equal". Equality of states is solved in shouldReplaceJob and can be rewritten in subclasses

Link copied to clipboard
open override fun start(scope: CoroutineScope): Job

Launch handling of states. On statesManager, statesManager will be called lambda with performing of state. If launchStateHandling will returns some State then statesManager will be used, otherwise StatesManager.endChain.

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

Just calls StatesManager.startChain of statesManager

Link copied to clipboard
open suspend override 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