interface IStateMachine<S, T : Any>
State machine interface that requires the ability to transition finite states.
abstract val state: S
Current state of the machine. |
|
abstract val transitions: Set<KClass<out T>>
Transitions available to the current state. |
abstract fun transition(transition: T): Unit
Transition the machine. |
|
abstract fun transitionsTo(targetState: S): Set<KClass<out T>>
Get the transition required to move to a given state. |
open class StateMachine<S, T : Any> : IStateMachine<S, T>
A basic state machine that is not thread safe. |