One transition with multiple events in UML State diagram
Asked Answered
O

2

5

We are learning in school that behavioral State diagram's transition has syntax:

list of events [guard condition] / list of actions

But I couldn't find any example on Internet where is used transition with multiple events. Is it really possible? If yes, how does it behave? Does it mean that transaction is realized when one of this events occurs (and of course condition is fulfilled)?

Olathe answered 30/10, 2016 at 9:59 Comment(0)
E
9

Yes, a transition can be triggered by one of many events in a list. You would use such a construct to avoid multiple lines between states, making a tidier diagram.

Here is what the 2.5 spec says:

14.2.3.9.2 Enabled Transitions

A Transition is enabled if and only if:

  • [ . . . ]

  • At least one of the triggers of the Transition has an Event that is matched by the Event type of the dispatched Event occurrence.

These logically OR'ed transitions are specified textually as a comma-separated list on the transition, as specified in §14.2.4.9:

[<trigger> [‘,’ <trigger>]* [‘[‘ <guard>’]’] [‘/’ <behavior-expression>]]
Earth answered 30/10, 2016 at 18:57 Comment(2)
Damn, why is it that you always find the cherries ;-)Sewerage
Thank you for your answer :)Olathe
S
2

Unfortunately the UML spec is not specific in that respect (I thought, but Jim has the right answer). Anyway:

14.2.4.9 Transition

The default textual notation for a Transition is defined by the following BNF expression:

[<trigger> [‘,’ <trigger>]* [‘[‘ <guard>’]’] [‘/’ <behavior-expression>]]

Where is the standard notation for Triggers (see sub clause 13.3.4), is a Boolean expression for a guard, and the optional is an expression specifying the effect Behavior written in some vendor- specific or standard textual surface language (see sub clause 16.1). The trigger may be any of the standard trigger types. SignalEvent triggers and CallEvent triggers are not distinguishable by syntax and must be discriminated by their declaration elsewhere.

There are other places in the specs where this paragraph appears in similar way, but without explaining how multiple triggers will be treated. I assume that it's an OR-condition. But that's only an assumption. Alas, since you have not seen examples (me neither) it is probably an unknown fact. Just don't use it - that's indeed possible ;-) And if you happen to find an example, just ask the author what he meant. UML is about talking to each other.

Sewerage answered 30/10, 2016 at 12:2 Comment(3)
Thank you for detailed answer :)Olathe
For multiple triggers, that's where PSSM (Precise Semantics for State Machines)is your friend even though it is not yet a formal specification: "A Transition may own a set of Triggers, each of which specifies an Event whose occurrence, when dispatched, may trigger traversal of the Transition."Lucienlucienne
I'm pleased to know other people are aware of PSSM!Earth

© 2022 - 2024 — McMap. All rights reserved.