umlstatediagrams

What is an order of transitions in state diagram? How to use history pseudo-states?


I read a lot about it, but still not sure in what order states executes (in Composite States) and how exactly deep and shallow history works? Could anybody help me? I have an example, which I'm not sure how to solve, here it is: enter image description here

I would appreciate any help!


Solution

  • Question 1:

    ... not sure .. how exactly deep and shallow history works?

    Answer 1:

    Note this:

    A shallow history is indicated by a small circle containing an "H". It applies to the state region that directly encloses it.

    Shallow history pseudostate represents the most recent active substate of its containing state (but not the substates of that substate). ...

    Source: http://www.uml-diagrams.org/state-machine-diagrams.html#shallow-history-pseudostate

    Question 2:

    ... I'm not sure if I always should start from initial point, which is outside of all composites?

    Answer 2:

    Yes. You start from the Initial Pseudostate of the root state (A in this case).

    Example:

    For the given state-chart and event chain, you would get the following result (simulated with Rhapsody):

    after default transition to A

    after default transition to A::B

    enter image description here

    after e1

    after default transition to A::C::G

    enter image description here

    after e3

    enter image description here

    after e4

    enter image description here

    after e6

    enter image description here

    after e7

    enter image description here

    e4 is discarded

    enter image description here