SC.Document (sc v1.0.2)

View Source

Represents a parsed SCXML document.

Summary

Functions

Build lookup maps for efficient O(1) state and transition access.

Find a state by ID using O(1) lookup.

Get all transitions from a given source state using O(1) lookup.

Types

t()

@type t() :: %SC.Document{
  datamodel: String.t() | nil,
  datamodel_elements: [SC.DataElement.t()],
  datamodel_location: map() | nil,
  document_order: integer() | nil,
  initial: String.t() | nil,
  initial_location: map() | nil,
  name: String.t() | nil,
  name_location: map() | nil,
  source_location: map() | nil,
  state_lookup: %{required(String.t()) => SC.State.t()},
  states: [SC.State.t()],
  transitions_by_source: %{required(String.t()) => [SC.Transition.t()]},
  version: String.t() | nil,
  version_location: map() | nil,
  xmlns: String.t() | nil
}

Functions

build_lookup_maps(document)

@spec build_lookup_maps(t()) :: t()

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.

find_state(document, state_id)

@spec find_state(t(), String.t()) :: SC.State.t() | nil

Find a state by ID using O(1) lookup.

get_transitions_from_state(document, state_id)

@spec get_transitions_from_state(t(), String.t()) :: [SC.Transition.t()]

Get all transitions from a given source state using O(1) lookup.