com.toxicbakery.kfinstatemachine

Package com.toxicbakery.kfinstatemachine

Types

IStateMachine

interface IStateMachine<S, T : Any>

State machine interface that requires the ability to transition finite states.

StateMachine

open class StateMachine<S, T : Any> : IStateMachine<S, T>

A basic state machine that is not thread safe.

TransitionBuilder

interface TransitionBuilder<out S, out T : Any>

Base definition for a partially defined transition.

TransitionCallback

interface TransitionCallback<S, T : Any>

TransitionDef

data class TransitionDef<S, T : Any>

Functions

onTransition

infix fun <S, T : Any> S.onTransition(event: KClass<out T>): TransitionBuilder<S, T>

Create a transition builder for a given state and transition event.

resultsIn

infix fun <S, T : Any> TransitionBuilder<S, T>.resultsIn(newState: S): TransitionDef<S, out T>

Define how a transition builder should end completing a fully defined transition definition.