Statifier.StateChart (statifier v1.9.0)
View SourceRepresents a running state chart instance.
Contains the parsed document, current configuration, and separate queues for internal and external events as specified by the SCXML specification.
Summary
Functions
Configure logging for the state chart.
Remove and return the next event from internal queue (higher priority). Falls back to external queue if internal queue is empty.
Add an event to the appropriate queue based on its origin.
Get deep history for a parent state.
Get shallow history for a parent state.
Check if there are any events in either queue.
Check if a parent state has recorded history.
Create a new state chart from a document with empty configuration.
Create a new state chart with a specific configuration.
Record history for a parent state before it exits.
Set the current event being processed.
Update the log level for the state chart.
Update the configuration of the state chart.
Update the datamodel of the state chart.
Types
@type t() :: %Statifier.StateChart{ configuration: Statifier.Configuration.t(), current_event: Statifier.Event.t() | nil, datamodel: Statifier.Datamodel.t(), document: Statifier.Document.t(), external_queue: [Statifier.Event.t()], history_tracker: Statifier.HistoryTracker.t(), internal_queue: [Statifier.Event.t()], invoke_handlers: %{required(String.t()) => invoke_handler()}, log_adapter: struct() | nil, log_level: atom(), logs: [map()] }
Functions
Configure logging for the state chart.
Parameters
state_chart- StateChart to configureadapter- Logging adapter instancelevel- Minimum log level (optional, defaults to :info)
Examples
adapter = %Statifier.Logging.TestAdapter{max_entries: 100}
state_chart = StateChart.configure_logging(state_chart, adapter, :debug)
@spec dequeue_event(t()) :: {Statifier.Event.t() | nil, t()}
Remove and return the next event from internal queue (higher priority). Falls back to external queue if internal queue is empty.
@spec enqueue_event(t(), Statifier.Event.t()) :: t()
Add an event to the appropriate queue based on its origin.
Get deep history for a parent state.
Returns all atomic descendant states that were active when the parent was last exited.
Get shallow history for a parent state.
Returns the immediate children that were active when the parent was last exited.
Check if there are any events in either queue.
Check if a parent state has recorded history.
@spec new(Statifier.Document.t()) :: t()
Create a new state chart from a document with empty configuration.
@spec new(Statifier.Document.t(), Statifier.Configuration.t()) :: t()
Create a new state chart with a specific configuration.
Record history for a parent state before it exits.
Uses the current active state configuration and the document to determine which states to record for shallow and deep history.
@spec set_current_event(t(), Statifier.Event.t() | nil) :: t()
Set the current event being processed.
Update the log level for the state chart.
@spec update_configuration(t(), Statifier.Configuration.t()) :: t()
Update the configuration of the state chart.
@spec update_datamodel(t(), Statifier.Datamodel.t()) :: t()
Update the datamodel of the state chart.