Download presentation
Presentation is loading. Please wait.
1
UML State Diagrams
2
State Diagrams State Diagrams are used to model the behavior of an individual object across its entire lifetime (i.e., across all use cases that it participates in)
3
State Diagrams A State Diagram shows
The different states that an object can be in The events that cause the object to change states The actions performed by the object when it changes state Basically just a finite state machine with some fancy features
4
State Diagrams Any class may have a State Diagram that describes the behavior of its instances Only create State Diagrams for classes that exhibit interesting "stateful" behavior Object's current behavior depends on its past in non-trivial ways State Diagrams contain: States Transitions
5
States A state is a situation during the life of an object during which it satisfies some condition, performs some activity, or waits for some event Example: Thermostat
6
Transitions A transition is a relationship between two states indicating that an object in the first state will perform certain actions and enter the second state when a specified event occurs and specified conditions are satisfied
7
Transitions Event Guard Action Message received or passage of time
Boolean expression that determines whether transition is enabled Action Executable, atomic computation performed when transition is taken Send message, create object, etc.
8
Transitions Example: Thermostat
9
Transitions Example: AlarmClock
10
Initial / Final states Example: Thermostat
11
Advanced Features State Diagrams have many advanced features that are not discussed here
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.