Skip to content

Constructing Flattened Transitions

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

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

Input

  1. A state or junction soj1 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 state or junction 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. Let sd1 be the state definition where soj1 is defined. Let sd2 be the state definition where soj2 is defined.

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

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

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

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

  6. 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.

  7. Return the state transition from soj1 to soj2' whose actions are the concatenation of A', A, A'', and A'''.

Clone this wiki locally