Shallow history

A shallow history is an element of a state machine. It is processed when it is reached by a transition that has the shallow history as a target.

The shallow history represents the most recent active state configuration of the containing state (but not recursively). It can have multiple default transitions - at most one for each region of the containing composite state. The default transition(s) is/are taken if the composite state was not active before the shallow history is reached (the first time).

A shallow history belongs to a composite state (not to a region).

Symbol

The symbol of a shallow history is a circle containing a "H".

images/download/attachments/2785317/shallow_history_symbol.png

Symbol in context

images/download/attachments/2785317/shallow_history_context_1.png

Example 1

  1. The composite state 'Composite state 1' is entered and becomes active (via the transition emanating from the initial pseudostate).

  2. Composite states 'Composite state 2' and 'Composite state 3' are also entered and become active (via the transitions emanating from the initial pseudostates).

  3. Simple state 'Simple state 1' is entered and becomes active (via the transition emanating from the initial pseudostate).

  4. Events 'E1' is fired. The state simple state 'Simple state 3' is entered and becomes active.

  5. Then the event 'E2' is fired. The simple states 'Simple state 2' and 'Simple state 4' are entered and become active.

  6. After event 'E2' is fired, composite state 'Composite state 1' is exited and simple state 'Simple state 5' is entered and becomes active.

  7. Now the automatic transition leaving the simple state 'Simple state 5' is processed.

  8. This leads to the composite state 'Composite state 1' being entered again by its shallow history. Now, because the composite state 'Composite state 1' was active before, simple states 'Simple state 2' and 'Simple state 3' are reactivated.

Example 2

  1. This time, after the composite state 'Composite state 1' is entered, event 'E1' is fired and 'E2' is not fired.

  2. After event 'E1' is fired, 'Simple state 3' is entered and becomes active.

  3. Then the event 'E3' is fired. Once again 'Composite state 1' is exited and 'Simple state 5' is entered.

  4. Now composite state 'Composite state 1' is entered again via its shallow history.

  5. This leads to composite states 'Composite state 2' and 'Composite state 3' becoming reactivated. Because the shallow history is not working recursively, only 'Composite state 2' and 'Composite state 3' are becoming active directly.

  6. The transitions emanating from the initial pseudostates are still going to be processed. This means that simple state 'Simple state 1' becomes active.

Characteristics

  • Shallow history does not work recursively. This means that all child states of the regions of the containing composite state that were active before, are reactivated - but not their children (As opposed to deep history, where children are also reactivated).

  • If the target of one of the default transitions is a composite state, than it proceeds with the default entry of the composite state.

  • Composite states can contain at most one shallow history.

  • The state machine is considered ill-formed if a shallow history is reached while the containing composite state has never been active before and it has no default transitions.

Interpretation of and deviation from the UML specification

UML specification

  1. At most one transition may originate from the history connector to the default shallow history state.

  2. History vertices can have at most one outgoing transition.

yasmine deviation

  1. At most one transition may originate from the history connector per region to the default shallow history state in that region of the containing composite state.

  2. History vertices can have more than one outgoing transition, but, at most one transition for each region of the containing composite state.