An event
that cannot be consumed, for example, because there is no matching transition, is
discarded.
The state machine in Figure 3.56 can consume the two time events at() and
the event terminate . The latter event activates the transition that leads to the fi nal
state, so that the state machine terminates since no other region is active.
193
3.7.2 State
16 Note that the state machine works meaningfully only provided that the world is created at
daytime.
3.7 The State Machine Diagram
FIGURE 3-56
A state machine, Day of Time, with pertaining structure.
stm
Time of day
class Time of Day
Day Night
at(sunset)/goToSleep()
at(sunrise)/getUp()
Terminate
hour:Integer
minute:Integer
second:Integer
Time of day
Defi nition
A state represents a set of value combinations for the underlying element.
It has a name, and may have an internal behavior that is executed based on
defined events.
A state represents a set of value combinations, for example, values for the
attributes of a class. In Figure 3.56 , you can see a class, Time of Day , in a class
diagram and a corresponding simple state machine diagram.
Pages:
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379