Package-level declarations

Types

Link copied to clipboard

Wrapper for "watching changes" syntax.

Link copied to clipboard
class EventTransitionBuilder<S, E : StateEvent, T : E>(scope: StateConversationalScope<S, E>, eventClass: KClass<T>)

Builder for event transitions with conversational syntax. Not an inner class to avoid type parameter shadowing.

Link copied to clipboard

Wrapper class to enable "starting at State" syntax.

Link copied to clipboard
class StateConversationalScope<S, E : StateEvent>(currentState: S)

Configuration scope for a specific state, providing conversational DSL.

Link copied to clipboard

Wrapper to add side effects after transition definition.

Properties

Link copied to clipboard

Starts the initial state configuration with "starting at State" syntax.

Link copied to clipboard

Starts observer configuration with "watching" keyword.

Functions

Link copied to clipboard
inline fun <S : Any, E : StateEvent> StateMachineBuilder<S, E>.during(state: S, configuration: StateConversationalScope<S, E>.() -> Unit)

Configures a state with conversational syntax: "during State { ... }"

Link copied to clipboard
infix fun <S, E : StateEvent> StateMachineBuilder<S, E>.initially(state: S)

Alternative syntax for setting initial state: "initially State"

Link copied to clipboard
fun <S, E : StateEvent> StateMachineBuilder<S, E>.onEveryTransition(effect: (oldState: S, newState: S) -> Unit)

Adds a global side effect that runs on every transition.

Link copied to clipboard
infix fun <S, E : StateEvent> StateMachineBuilder<S, E>.tracking(with: String): ((S, S) -> Unit) -> Unit

Adds an observer using "tracking with" syntax.

Link copied to clipboard

Sets the state validator directly.

Link copied to clipboard

Sets the state validator with conversational syntax.