Search code examples
umlstate-machine

What is the meaning of these UML elements and how do they react?


In this image we can see:

  1. A transition without any event
  2. The shallow history state

Problems are:

  1. What dose it mean of having two transitions from B to A?
  2. Is action "c" always fired when we transition from B to A even though we take the edge with no events written to it?
  3. What does that history state do if there are no edges going into it? Is it useless?

Image with the elements circled in red

I could not find any information about a history state without edges pointing into it.


Solution

  • The two transitions are fired on different events and have different effects: The y/c transition is fired if event y happens, and when fired the behaviour c is performed. The second transition is a transition that happens when B is completed and no y happened; in this case, c is not performed.

    The history state is a little more tricky, and I therefore edited my original answer:

    • It has no apparent incoming edge. The rules of the game is that if the state B is entered or re-entered, its initial substate is activated, since there is one. The history to be effective would require a direct transition from outside.
    • There is an explicit outgoing edge from history to F. Normally there is no need for an outgoing edge, since the transition to the history state should resume the last active state in the region. However, this outgoing edge represents the default transition in case there is no such history, i.e. the region was never entered before, or if the region was previously left reaching its final state. In your diagram this explicit default is not really needed, because if such a default transition is not shown, the history is assumed to go directly to the initial node.