3.6 State Diagrams: © J.W. Schmidt, Florian Matthes 1999
3.6 State Diagrams: © J.W. Schmidt, Florian Matthes 1999
o is attached to exactly one class o can be inherited by subclasses (where the concept of the refinement is not defined exactly)
State Diagrams
3.6.2
3.6.1
A state is a constraint or a situation in the life cycle of an object, in which a constraint holds, the object executes an activity or waits for an event.
Notation:
passive
active
state
State Diagrams
name
state transition
3.6.3
Notation:
start state
final state
State Diagrams
3.6.4
3.6.2
Transitions
A transition connects two states and shows the flow of control. A transition can include a triggering event, a guard and actions to be executed. Transitions without event and guard are executed immediately when an activity is finished respectively all sub states were passed through.
Notation:
guard
login(user) [NumberOfUsers < max] / greet(user) turn off login active self transition action login(user) [NumberOfUsers = max] / deny(user)
State Diagrams 3.6.5
passive
Events
An event is a phenomenon in space and time significant for the modeled system.
An event can appear synchronously or asynchronously. o synchronous events: call event: triggered by call exception event: triggered by called object at return o asynchronous events: signal event: signal sent by other object change event: triggered by side effects on object attributes time event: spontaneously triggered by boolean guard over time
State Diagrams
3.6.6
3.6.3
State Diagrams
3.6.7
Call Events
Notation:
event
parameter
manual control
startAutopilot(goal)
automatic control
state
Name and parameter of the event must be compatible to methods of the class.
State Diagrams
3.6.8
3.6.4
A change event occurs if a specific constraint is fulfilled. The constraint is a boolean expression on the attributes of the actual object. change event
Notation:
time event
State Diagrams 3.6.9
Sending Signals
Signals can be sent to other objects during a transition.
Notation: active alternative after 10 min. / send central.amAlive(self) after 10 min send amAlive(self) active
send signal
receiving object
central
State Diagrams
3.6.10
3.6.5
Triggering Actions
Possible actions: o send signal o perform call o perform access Notation: entry action active exit action intern transition activity delayed event
State Diagrams 3.6.11
entry / startMotor(3000 U/Min) exit / stopMotor() new speed x / speed(x) do / warningLight() turn electricity off / defer
Composite States
A state can be refined hierarchically by composite states. Notation: composite state active card inserted abort inspection [ok] transition from sub state key in the machine ready choice transfer(x) transaction sub state start state
card inserted
3.6.6
Notation: finish
error
join
test devices
fork final test hardware test test ports installation software test test modules test application test devices
join
operating
State Diagrams
3.6.14
3.6.7