View Source Protean.Machine (Protean v0.0.1)
Purely-functional statechart core.
Provides the underlying state-transition logic for a statechart, primarily through
transition/3
, a higher-level transition API for using %Protean.Machine{}
apart from the
interpreter provided by Protean, and take_transitions/3
, a lower-level API used by a
statechart interpreter.
It is uncommon to use this module independently of the Protean
behaviour.
Link to this section Summary
Functions
Returns the initial Protean.State
for a given machine.
Given a machine, a machine state, and an event, transition to the next state if the machine defines a transition for the given state and event.
Link to this section Types
@type t() :: %Protean.Machine{ handler: module(), idmap: %{required(Protean.Node.id()) => Protean.Node.t()}, initial_context: Protean.State.context(), root: Protean.Node.t() }
A full Protean machine configuration.
Link to this section Functions
@spec initial_state(t()) :: Protean.State.t()
Returns the initial Protean.State
for a given machine.
@spec select_automatic_transitions(t(), Protean.State.t()) :: [Protean.Transition.t()]
@spec select_transitions(t(), Protean.State.t(), Protean.event()) :: [ Protean.Transition.t() ]
@spec take_transitions(t(), Protean.State.t(), [Protean.Transition.t()]) :: Protean.State.t()
@spec transition(t(), Protean.State.t(), Protean.event()) :: Protean.State.t()
Given a machine, a machine state, and an event, transition to the next state if the machine defines a transition for the given state and event.