Skip to content

Constructing Flattened Transitions

Rob Bocchino edited this page Sep 13, 2024 · 25 revisions

This algorithm constructs a flattened transition 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 transition t.

Output

  1. A transition that records all actions specified in the source model together with all entry and exit actions implied by the state machine hierarchy.

Procedure

  1. If t is an internal transition, then return t.

  2. Otherwise

    1. Let A be the actions of t, and let soj2 be the target of t.

    2. For each i in [1,2]

      1. If soji is a state definition sd or is a junction defined in a state definition sd, then

        1. Let sdoi be Some(sd).

        2. Let Li be the list of state definitions in the state hierarchy from the top level to sd, including sd, highest first.

      2. Otherwise let sdoi be None, and let Li be the empty list.

    3. Let P be the common prefix of L1 and L2.

    4. If P is nonempty with last element sd and either sd1 or sd2 equals Some(sd), then t represents a self transition, and sd is the outer state definition. Remove sd from P so that we exit and reenter sd.

    5. For each i in [1,2], let L'i be Li with the prefix P removed.

    6. Let L''1 be the reverse of L'1. Let A1 be the concatenation of the exit action lists of the elements of L''1.

    7. Let A2 be the concatenation of the entry action lists of the elements of L'2.

    8. Return the external transition whose actions are the concatenation of A1, A, and A2, and whose target is soj2.

Clone this wiki locally