Professional Documents
Culture Documents
Object-Oriented Modeling and Design with UML; Michael Blaha, James Rumbaugh
Contents
Introduction State diagrams Events States Transitions and conditions State diagram behavior Concurrency Summary
2006-04-11
2/22
Introduction (1/2)
State model
Describes sequences of operations that occur in response to external stimuli Consists of multiple state diagrams, one for each class with behavior
State diagram
Graphical representation of finite state machines relates events and states
2006-04-11
3/22
Introduction (2/2)
Finite state machine
Model of behavior composed of states, transitions and actions
2006-04-11
4/22
Timeout
Blacks turn checkmate Chess Using entry & Exit points Start checkmate Whites turn black moves white moves stalemate Black wins Draw White wins 6/22
Blacks turn
checkmate
2006-04-11
Events (1/4)
Definition
Occurrence at a point in time
Following another event Two events related or unrelated
2006-04-11
7/22
Events (2/4)
Signal Event
Event of sending or receiving a signal Attributes indicating the values
<<signal>> FlightDeparture flightNumber city date <<signal>> MouseButtonPushed button location
Signals generalization
Hierarchy with inheritance of signal attributes
2006-04-11
8/22
Events (3/4)
Signals generalization Signal Event
UserInput Event of sending or receiving a signal device Attributes indicating the values
<<signal>>
<<signal>> FlightDeparture <<signal>> <<signal>> flightNumber MouseButton FightDeparture city flightNumber location date city date
MouseButtonDown
<<signal>> <<signal>> Signals generalization
<<signal>> MouseButtonPushed <<signal>> <<signal>> MouseButtonPushed button KeyboardCharacter button location character location
<<signal>> <<signal>>
MouseButUp
Control
Graphic
<<signal>>
Space
Alphanumeric
<<signal>>
Punctuation 9/22
<<signal>>
2006-04-11
Events (4/4)
Change Event
Satisfaction of a boolean expression
When (room temperature<heating set point) When (tire pressure<minimum pressure)
Time Event
Satisfaction of a time expression
When (date = January 1, 2000) After (10 seconds)
2006-04-11
10/22
States (1/3)
Definition
Abstraction of the value and links of an object
Solvent Insolvent Dial tone Dialing Powered
2006-04-11
11/22
States (2/3)
Simple state
No nested substates
Waiting Dialing Powered
Composite state
One or more region One or more nested substates
2006-04-11
12/22
States (3/3)
Submachine state
Reference a submachine another state machine
Idle Collecting money coins in(amount) / add to balance
dispense: Dispenseitem
do / make change
13/22
Structures of transitions
Source state SelectMode click(point) / select(point) trigger effect target state SelectMode
/reset election
Choose
timeout[no cars
timeout
timeout
2006-04-11
16/22
Do-activities
Activity that continues for an extended time
Paper jam do / flash warning light
2006-04-11 17/22
Activities on transition
Opening entry/motor up door open Open entry/motor off depress
Concurrency (1/3)
Definition
Aggregation concurrency
State diagram for an assembly of state diagram, one for each part
Car 1 Ignition Ignition Off 1 Transmission 1 1 Accelerator 1 Brake release key Starting On
2006-04-11
19/22
Concurrency (2/3)
Concurrency within an object
Partition some object into subsets of attributes or links, each of which has its own subdiagram
Bridge Playing rubber N-S vulnerability Not vulnerable E-W vulnerability Not vulnerable N-S game vulnerable E-W game vulnerable N-S game N-S wins rubber E-W game E-W wins rubber
2006-04-11
20/22
Concurrency (3/3)
Synchronization of concurrent activities
Complete both activities before it can progress to its next state Control can split into concurrent activities that subsequently merge
CashDispenser
ready Setting up
2006-04-11
21/22
Summary
State diagram consists of
States Events Guard conditions Activities
2006-04-11
22/22