StateAction

abstract class StateAction(source)

Runtime context passed to every statechart action block. Exposes the owning agent so handlers can read or mutate agent state, and provides transitionTo to schedule a transition to another state.

Transitions are scheduled, not executed in place: calling transitionTo inside an action records the target and lets the current handler finish, then the transition runs as a zero-delay event. This avoids re-entrance issues when an action triggers another transition via cascading message arrivals or condition tests.

If an action calls transitionTo more than once, the last call wins. Subsequent calls are silently ignored if a transition is already pending.

The agent reference is typed as AgentLike so the same handler signature works for both AgentModel.Agent and AgentResource. Cast to the concrete type at the call site when an action needs owner-specific state.

Properties

Link copied to clipboard
abstract val agent: AgentLike
Link copied to clipboard
abstract val currentStateName: String

Functions

Link copied to clipboard
abstract fun transitionTo(stateName: String)