1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Purpose of a state machine diagram
To model:
- possible states of a system/object
- transitions between states triggered by events
- behaviour in each state
Activities within a state
entry/Activity: runs on entering the state
exit/Activity: runs on exiting the state
do/Activity: runs while in the state
Components of a transition
Event (trigger)
Guard (boolean condition)
Effect (actions during transition)
Internal vs External transitions
Internal: No state change (e.g. event1 triggers Activity3 in state1) External: State change (e.g. event1 moves from state1 to state2)
Types of events
Signal event (e.g. rightMouseDown)
Call event (e.g. register(exam))
Time event (e.g. after(5 secs))
Initial state
A pseudo-state with:
- no incoming edges
- immediate transition to next state
- guards on outgoing edges must be mutually exclusive
Final state vs Terminate node
Final state: object remains here (end of lifecycle)
Terminate node: object is deleted
Decision node
Splits transitions into alternative paths with guards (e.g. [x > 0])
Parallelisation node
Splits control flow into concurrent sub-flows (1 input -> N outputs)
Synchronisation node
Merges concurrent sub-flows into one (N inputs -> 1 output)
Change events vs Guards
Change event: continuously checked (e.g. when(x > y))
Guard: checked only when event occurs
Model a LectureHall
[Free] -(occupy)-> [Occupied] [Occupied] -(release)-> [Free]
States
Represents conditions or situations during the lifecycle of an object
Transitions
Represents the movement from one state to another, triggered by events, guards or activities
Events
Triggers that cause a transition
Guards
Boolean conditions that must be true from a transition to occur
Activities
Actions executed when entering, exiting or during a state
When is a do-activity aborted?
When an event triggers a transition with no guard condition
Time event
An event like when(date=31.12.2001) that triggers at a specific time