SECOND, d22_5403);
48 addStateDisplay("Stopped", -1, METime.SECOND, d22_4302);
49 }
216 DIGITAL WRISTWATCH
de?¬?nitions (lines 47 and 48), while the basic method de?¬?nition and opening of the
switch statement in lines 51??“54 again come from the ???_Java??? subgenerator.
The generation of the code for the actions triggered during the state transitions
(lines 55??“65) is a good example of howto be creative in integrating the code generator
and the modeling language. On the modeling language level, each action is modeled
with a relationship type of its own. When the code for them is generated, the
???_Actions??? subgenerator ?¬?rst provides the master structure for each action de?¬?nition:
a case statement using the unique ID of the Action. It then follows the relationships for
each part of the action and executes the subgenerator bearing the same name as the
current action relationship (either ???_Icon,??? ???_Roll,??? ???_Alarm,??? or ???_Set???). The
subgenerator produces an appropriate line of code for this part of the action, for
example turning an icon on in line 60. This implementation not only reduces the
generator complexity but also provides a ?¬‚exible way to extend the watch modeling
language later if new kinds of actions are needed.
Finally, the ???_DisplayFns??? and ???_calcValue??? subgenerators produce the
calculations required by the display functions (lines 66??“69).
Pages:
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398