State Diagram
description
Transcript of State Diagram
![Page 1: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/1.jpg)
1
State Diagram
![Page 2: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/2.jpg)
2
State Diagram
State diagram: Shows the behavior of one object. They describe all of the possible states that a particular object can get into and how the object's state changes as a result of events that reach the object.
Other names: State transition diagram Harel diagram (statecharts)
![Page 3: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/3.jpg)
3
Events, States and Transactions
Event: is a significant or noteworthy occurrence. Ex: a telephone receiver is taken off the hook.
State: is a condition of an object at a moment in time (the time between events) Ex: a telephone is in state of being idle after the receiver is placed
on the hook and until it is taken off the hook.
Transaction: is a relationship between two states that indicates that when an event occurs, the object moves from the prior state to the subsequent state. Ex: When the event "off hook" occurs, transition the telephone from
the "idle" to "active" state.
![Page 4: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/4.jpg)
4
![Page 5: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/5.jpg)
5
State Diagram Syntax
Initial and final states: Initial state denoted by a filled black circle and may
be labeled with a name. Final state denoted by a circle with a dot inside, and
may also be labeled with a name.
![Page 6: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/6.jpg)
6
State Diagram Syntax
State Action If the target state had many transitions arriving at it,
and each transition had the same effect associated with it, it would be better to associate the effect with the target state rather than the transitions.
![Page 7: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/7.jpg)
7
State Diagram Syntax
Self Transitions: A state can have transition that return to itself.
![Page 8: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/8.jpg)
8
State Diagram Syntax
Compound state A state diagram may
include sub diagrams.
![Page 9: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/9.jpg)
9
State Diagram Syntax
Entry point When you won’t want to enter a sub-state at the
normal initial state.
![Page 10: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/10.jpg)
10
State Diagram Syntax
Exit point:
![Page 11: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/11.jpg)
11
State Diagram Syntax
Choice Pseudo-State Shown as a diamond with one transition arriving and
two or more transitions leaving.
![Page 12: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/12.jpg)
12
State Diagram Syntax
Junction Pseudo-State used to chain together multiple transitions. A single
junction can have one or more incoming, and one or more outgoing, transitions.
![Page 13: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/13.jpg)
13
State Diagram Syntax
Terminate Pseudo-State The lifeline of the state machine has ended.
![Page 14: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/14.jpg)
14
Example
![Page 15: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/15.jpg)
15
Example
![Page 16: State Diagram](https://reader035.fdocuments.in/reader035/viewer/2022062520/56816244550346895dd27e78/html5/thumbnails/16.jpg)
16
Example