Statifier.Document (statifier v1.9.0)
View SourceRepresents a parsed SCXML document.
Summary
Functions
Build lookup maps for efficient O(1) state and transition access.
Find all history states within a parent state.
Find a state by ID using O(1) lookup.
Get all states from the document hierarchy as a flat list.
Get the default transition targets for a history state.
Get all transitions from a given source state using O(1) lookup.
Check if a state is a history state.
Types
@type t() :: %Statifier.Document{ binding: String.t() | nil, binding_location: term(), datamodel: String.t() | nil, datamodel_elements: [Statifier.Data.t()], datamodel_location: map() | nil, document_order: integer() | nil, hierarchy_cache: Statifier.HierarchyCache.t(), initial: [String.t()], initial_location: map() | nil, name: String.t() | nil, name_location: map() | nil, source_location: map() | nil, state_lookup: %{required(String.t()) => Statifier.State.t()}, states: [Statifier.State.t()], transitions_by_source: %{required(String.t()) => [Statifier.Transition.t()]}, validated: boolean(), version: String.t() | nil, version_location: map() | nil, xmlns: String.t() | nil }
Functions
Build lookup maps for efficient O(1) state and transition access.
This is typically called after the document structure is built to populate the lookup maps from the state hierarchy.
@spec find_history_states(t(), String.t()) :: [Statifier.State.t()]
Find all history states within a parent state.
Returns a list of history states that are direct children of the specified parent. Returns an empty list if the parent is not found or has no history children.
@spec find_state(t(), String.t()) :: Statifier.State.t() | nil
Find a state by ID using O(1) lookup.
@spec get_all_states(t()) :: [Statifier.State.t()]
Get all states from the document hierarchy as a flat list.
Returns all states including nested children from the document's state hierarchy.
Get the default transition targets for a history state.
Returns a list of target state IDs from the history state's default transitions. Returns an empty list if the state is not found, not a history state, or has no transitions.
@spec get_transitions_from_state(t(), String.t()) :: [Statifier.Transition.t()]
Get all transitions from a given source state using O(1) lookup.
Check if a state is a history state.
Returns true if the state exists and has type :history, false otherwise.