ExMachine.Machine (ex_machine v0.1.2)

View Source

Summary

Functions

Dispatch an event to the machine, performing all the necessary activities and returning the machine in the new active configuration.

Returns list of currents active states.

Initialize the machine, performing all the necessary activities and returning the machine in its initial active configuration

Returns last executed macrostep

Returns last executed list of microstep

Returns last executed list of transitions

Types

t()

@type t() :: %ExMachine.Machine{
  configuration: [[String.t()]],
  context: term(),
  macrosteps: [
    %ExMachine.Macrostep{
      actions: term(),
      entered: term(),
      event: term(),
      exited: term(),
      microsteps: term(),
      timestamp: term(),
      transitions: term()
    }
  ],
  queue: list(),
  running?: boolean(),
  statechart: ExMachine.Statechart.t(),
  states_histories: map()
}

Functions

dispatch(machine, event)

Dispatch an event to the machine, performing all the necessary activities and returning the machine in the new active configuration.

If during execution some activities raises internal events, the machine continues execution of these events until the internal queue is empty (run to completion)

get_active_states(machine)

Returns list of currents active states.

Generally, there is only one active state if the machine is not in a parallel (orthogonal) state, otherwise its the list of active states of each active region

init(statechart, context)

Initialize the machine, performing all the necessary activities and returning the machine in its initial active configuration

The log of the transition to initial state are recorded in the first Macrostep

last_macrostep(machine)

Returns last executed macrostep

last_microsteps(machine)

Returns last executed list of microstep

last_transitions(machine)

Returns last executed list of transitions

new(statechart, context)