|
Re: Ignoring Unexpected Messages [message #1754088 is a reply to message #1754037] |
Tue, 14 February 2017 13:09 |
|
The algorithm to handle transitions will alway start at the current state and then move up the state containment.
As such, the easiest way to handle these unexpected messages is to create an internal transition to history in the container state. that internal transition's trigger can be set to "*" to catch all messages and then process these messages according to your particular needs or even suppress the error message entirely by doing nothing.
/Charles Rivet
|
|
|
|
|
|
|
Re: Ignoring Unexpected Messages [message #1754369 is a reply to message #1754246] |
Thu, 16 February 2017 21:49 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
I assume that your question is about Papyrus-RT, not Papyrus per-se. Base Papyrus implements UML. Papyrus-RT implements UML-RT. UML and UML-RT have a slightly different semantics for history.
The official story is available in the OMG UML 2.5 spec at http://www.omg.org/spec/UML/2.5/.
You'll find the description of history in page 323.
The short version is this: when a transition ends in the history pseudo-state of a composite state CS1, then the last active substate SS1 of CS1 is entered. This is the case regardless of whether the transition comes from the inside or the outside of CS1. There are two kinds of history: shallow and deep. With shallow history, the entered substate SS1 follows its initial transition. With deep history, it goes to SS1's history point (if it has one), and therefore it recursively enters all the last active substates.
History is useful to remember where you where when you were doing something in a composite state and go back there. The typical use is when you exit a composite state via a group transition, and then enter again.
This of course is the UML semantics. For UML-RT, the idea is that only deep history is supported, and that a transition that ends in a composite state is deemed to be as if it ended in the composite state's history pseudo-state.
So the solution that Charles was suggesting was to put the states that you are interested in into a composite state (say CS1) with an internal transition whose source and target are both CS1, and with a trigger set to "any event" (i.e. '*'). Because the source is the composite state, it is as if the transition's source is any of its contained states. Because its target is CS1 itself, it is as if it went to deep history, so when triggered, it will return to whichever state it was last in. And because the event triggers are considered "inside-out" (i.e. from the innermost states to the outermost), then this transition will have the lowest priority and will not override other transitions inside this CS1.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03625 seconds