com.toxicbakery.kfinstatemachine / IStateMachine

IStateMachine

interface IStateMachine<S, T : Any>

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

Properties

state

abstract val state: S

Current state of the machine.

transitions

abstract val transitions: Set<KClass<out T>>

Transitions available to the current state.

Functions

transition

abstract fun transition(transition: T): Unit

Transition the machine.

transitionsTo

abstract fun transitionsTo(targetState: S): Set<KClass<out T>>

Get the transition required to move to a given state.

Inheritors

StateMachine

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

A basic state machine that is not thread safe.