2

What is the notation for a common trigger in a UML state machine? What about multiple common triggers?

Let's say we have at state-machine with 20 states. 18 of these states have a common trigger, that would transition to State_A. Another common trigger would transition to State_D.

What is the graphic notation notation for this? any example would be appreciated.

Kind regards, Ole

EDIT

Is this a valid notation?

enter image description here

xmojmr
  • 8,073
  • 5
  • 31
  • 54
Ole Tetzschner
  • 91
  • 1
  • 3
  • 9
  • Thanks xmojmr, but is this a valid notation? – Ole Tetzschner Jan 13 '15 at 12:46
  • That's a good question. Let's wait for a good answer (it takes 24 hours to rotate your question around the globe). To me it looks suspicious because the `initial pseudostate/entry point pseudostate` should be limited as "_there can be at most one initial vertex in a region/In each region of the state machine or composite state it has at most a single transition to a vertex within the same region_". Right now I don't even have a tip for suitable Google keywords – xmojmr Jan 13 '15 at 13:08

3 Answers3

1

The trick is to decompose the problem into hierarchical state machines (see also Wikipedia: UML state machine → Hierarchically nested states) with submachine states and composite states etc. as you can see below in the examples taken from Kirill Fakhroutdinov's online book

uml-diagrams.org: Bank ATM, UML State Machine Diagram Example

enter image description here

uml-diagrams.org: Java 6 Thread States and Life Cycle, UML Protocol State Machine Diagram Example

enter image description here

xmojmr
  • 8,073
  • 5
  • 31
  • 54
1

Your notation is valid. It makes use of entry points and that is fine. Please be aware that there are different notation variants for entry points. As an alternative to entry points you could also use transitions that directly target the substates. Here is your 'simplified' example:

enter image description here

By the way this example is build with the open source Yakindu Statechart Tools. It provides build in simulation - so you can interactively execute the statecharts.

Axel T.
  • 166
  • 5
0

Use junction element. Junction is used when lot of transitions lead to one state. It makes state machine diagram clear. Read UML Superstructure, part StateMachine subpart pseudostates.

Example of state diagram with Junction element:

enter image description here

Vladimir
  • 2,066
  • 15
  • 13
  • 1
    Thanks Vladimir, but with junction I still have to draw a transition from nearly all states. If I have over 20 states it would be a graphic mess. If it is possible to draw a this common-trigger with one transition, the graphics would be easier to read/understand. Any solutions to this problem? – Ole Tetzschner Jan 15 '15 at 19:53
  • I am afraid there is not specialized element to design explicit target state, but following solution could be suitable. If all your states are substates of one parent state, the parent state can by connected by transition started from parentstate edge to state you need address from all substates. Whenever behavior inside of parent state reached FinalState, the transition I described above will be activated and start to execute target state.But it is necessary to create transition to final state from each states inside of parent as well, Or add as many final states as needed close to states. – Vladimir Jan 16 '15 at 12:12
  • @Vladimir can you visualize your solution applied to the State_A, State_B, State_C example in OP's question? Or visualize it on some other example resembling the original problem with "_state-machine with 20 states. 18 of these states have a common trigger..._"? – xmojmr Jan 21 '15 at 06:22