Each state there is decomposed into its own Watch
Application diagram (e.g., Stopwatch shown in Fig. 9.3) containing the behavior of
that application.
The AlarmClock application in Fig. 9.7 shows some aspects not present in the
Stopwatch. When the application starts, we move straight to the Showstate, where (as
indeed in all states in this application) the Display Function simply shows the
alarmTime variable. Pressing the Set button takes us to the EditHours state, where the
hours are ?¬‚ashing on the display. Pressing the Up or Down buttons there rolls the hours
value of alarmTime up or down. Note that the thick dark red role from EditHours
MODELS 207
returns back to EditHours along the same path, ending in an arrowhead, making the
role leaving EditHours invisible. Another way to draw this would be as a circular
relationship, but as these are so common, it was thought that the modeler would prefer
this shorthand: all four roles of the transition are present; the From role is just not
particularly visible. Pressing Mode in EditHours takes us to the similar EditMinutes,
and vice versa.
Pressing Set in either Edit state takes us back to the Show state, carrying out the
Action immediately belowand to the right of Showon the way. This turns on the alarm
icon and sets the AlarmClock alarm to ring after a while, calculated as alarmTime
minus clockTime.
Pages:
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385