Download presentation
Presentation is loading. Please wait.
Published byVictor Carroll Modified over 8 years ago
1
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML State Diagrams
2
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Objectives To present advanced features of the UML state diagram notation To illustrate uses of state diagrams with advanced features To present heuristics for making good state diagrams with advanced features
3
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Topics Concurrent composite states Compound transitions History and deep history states More state diagram heuristics
4
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Concurrent Composite States The regions in a concurrent composite state nested state compartment contain state diagrams that execute in parallel. One state in each region is entered when the concurrent composite state is entered. One state from each region is always among the joint concurrent states until the concurrent composite state is exited. Events cause transitions in each concurrent region to occur simultaneously.
5
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5 Concurrent Composite State Example
6
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Entering Concurrent Composite States Make a transition to the concurrent composite state boundary The initial state in each region becomes the current state Make a transition to individual states in different regions Main transition goes to a fork bar Transitions to individual state come from the fork bar A region without a state targeted by a transition begins in its initial state
7
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Entering Selected Concurrent States: Illustration
8
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 8 Leaving Concurrent Composite States Make a transition from the concurrent composite state boundary For a non-completion transition, all concurrent sub-states are exited immediately For a completion transition, the current state must be a final state in every concurrent region Make a transition from one or more concurrent sub-states Coordinated transitions can go to a join bar All other sub-states are exited immediately
9
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 Leaving Selected Concurrent States: Illustration
10
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Using Concurrent Composite States Any concurrent composite state can be represented by a diagram with only simple states, but it will have many more states than the concurrent composite state. Concurrent composite states thus simplify diagrams. On the other hand, diagrams with concurrent composite states are often hard to understand.
11
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11 Compound Transitions Transitions from multiple sources or to multiple targets with common transition strings Transition arrows from multiple sources may converge on a transition junction point from which a single arrow goes to a target Common transition string stated only once A transition arrows with a single event string may end at a junction point from which emerge arrows with mutually exclusive guards to multiple targets Symbol is a filled circle
12
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 Compound Transition Example
13
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 13 History States A history state is a pseudo-state indicating that the sub-state last active when a composite state was exited should be reentered. Symbol is a circled H Many common devices have persistent state, so this is a useful modeling feature.
14
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 History State Example
15
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 15 History State Restrictions May only appear in a region of a composite state Transitions may only enter a history state from outside the composite state May have at most one unlabeled outgoing transition to a peer state Indicates the default reentered state if the composite state has not yet been entered History states may not have internal transitions, nested compartments, etc. History state is forgotten if the current inner state becomes a final state.
16
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Deep History States A history state indicates reentry to a state at the same nesting level. States at lower nesting levels are entered as usual (initial states). A deep history state is a pseudo-state indicating that the states last active at every nesting level when a composite state was exited should be reentered. Symbol is a circled H*
17
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Deep History State Example
18
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18 More State Diagram Heuristics 1 Avoid concurrent composite states, especially those with synch states. Designate an initial state in every concurrent region of a concurrent composite state. Check that transitions to several concurrent sub-states go through a fork.
19
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19 More State Diagram Heuristics 2 Check that arrows connected to transition junction points are properly labeled. Check that at most one unlabeled arrow emanates from each history state. Check that every sequential state diagram containing a history state has an initial state.
20
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 Summary State diagrams can show concurrency concurrent composite states, but these are governed by somewhat complex rules and hard sometimes hard to understand. Compound transitions allow combination of several transitions with common transition strings into one. History and deep history states allow state diagrams to model persistent states.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.