Skip to content

Constructing Flattened Transitions

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

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

Input

  1. The current state machine analysis data structure sma.

  2. A state or junction soj1 representing the source of the transition in the hierarchical state machine.

  3. 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 let Li be the list of state definitions in the state hierarchy in sma from the top level to sd, including sd, highest first.

      2. Otherwise let Li be the empty list.

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

    4. If each of soj1 and soj2 is a state definition that is contained in P, then t represents a self transition, and the last element sd of P 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