Skip to content

Constructing Flattened Transitions

Rob Bocchino edited this page Jul 28, 2024 · 25 revisions

This algorithm constructs a flattened transition to a state or junction.

Input

  1. An optional state or junction soj1Opt representing the source of the transition in the hierarchical state machine.

  2. A state or junction soj2 representing the destination of the transition in the hierarchical state machine.

  3. A list A of actions specified in the source model.

Output

  1. A transition that goes to a leaf state or junction and that records all actions specified in the source model together with all entry actions, exit actions, and initial transition actions implied by the hierarchical structure.

Procedure

  1. If soj1Opt is Some(soj1) then

    1. Let sd1 be the state definition where soj1 is defined.

    2. Let sd2 be the state definition where soj2 is defined.

    3. Compute the state definition sd which is the lowest common ancestor of sd1 and sd2 in the AST.

    4. Let A' be the list of exit actions, in order, seen when passing from sd1 to sd.

    5. Let A'' be the list of entry actions, in order, seen when passing from sd to sd2.

  2. Otherwise let A' and A'' each be the empty list of actions.

  3. If sd2 is a leaf state or junction, then let soj2' be soj2, and let A''' be the empty list of actions.

  4. Otherwise

    1. Let soj2' be the unique leaf state reachable from soj2 by following a chain of initial transition specifiers.

    2. Let A''' be the list of do actions and entry actions seen when following the chain, in the order they are seen.

  5. Return the transition whose actions are the concatenation of A', A, A'', and A''' and whose destination is soj2'.

Clone this wiki locally