Package-level declarations

Types

Link copied to clipboard

State container that handles events and transitions states accordingly.

Link copied to clipboard

Handler for a specific event within a state.

Link copied to clipboard

Convenience typealias for event handlers that ignore the event payload.

Link copied to clipboard

Configuration for a specific state in the state machine.

Link copied to clipboard
interface StateEvent

Marker interface for all state events.

Link copied to clipboard
fun interface StateEventHandler<T, E : StateEvent>

Interface for handling state events and producing new states.

Link copied to clipboard

Thread-safe implementation of StateMachine with event-driven state transitions.

Link copied to clipboard

DSL builder for creating state machines with a fluent API.

Functions

Link copied to clipboard

Creates a StateEventHandler that always returns the same state regardless of the event.

Link copied to clipboard
fun <T, E : StateEvent> transitionFrom(transform: (T) -> T): StateEventHandler<T, E>

Creates a StateEventHandler that transitions to a state based on the current state.

Link copied to clipboard
fun <T, E : StateEvent> transitionTo(newState: T): StateEventHandler<T, E>

Creates a StateEventHandler that always transitions to a specific state.

Link copied to clipboard
fun <T, E : StateEvent> transitionWith(transform: (T, E) -> T): StateEventHandler<T, E>

Creates a StateEventHandler that transitions based on both state and event.