I do not know if there is a good way to represent this in a UML2 statechart diagram.
Given a set of states, State 1, State 2, State 3, and State 4. Given a set of events, Event 2, Event 3, and Event 4.
States have a relative priority indicated by the State number. A higher number is higher priority. Receiving an event with a number that matches the state number toggles if that state is potentially active. Given that State 1 is a default priority, there is no event to toggle this priority.
So, for the following sequence of events I would expect the following transition:
- State machine initialization -> Enter State 1
- Event 2 -> State 2 becomes potentially active. Transition from State 1 to State 2.
- Event 4 -> State 4 becomes potentially active. Transition from State 2 to State 4.
- Event 3 -> State 3 becomes potentially active. No transition.
- Event 4 -> State 4 leaves potentially active. Transition from State 4 to State 3.
- Event 2 -> State 2 leaves potentially active. No transition.
- Event 3 -> State 3 leaves potentially active. Transition from State 3 to State 1.
The only way that I can think of to diagram this as a statechart is to have an orthogonal state. One side captures events to determine if each state is potentially active. The other side would have to transition based on the current set of states in the first side. This seems pretty ugly and confusing.
Is there a good way to represent this in a UML2 statchart diagram?