They also de?¬?ne the variables used (lines 9??“10)
and the implementations of their accessing methods (lines 12??“30). A short return
back to the ???_Java??? subgenerator produces lines 32??“34, followed by the state
(lines 35??“38) and state transition de?¬?nitions (lines 40??“45) generated by the
???_StateData??? and ???_TransitionData??? subgenerators. The ???_StateDisplayData??? and
???_StateDisplayDataContent??? subgenerators then provide the display function
FIGURE 9.11 The watch code generator architecture, part 2.
CODE GENERATION FOR WATCH MODELS 215
Listing 9.4 The generated code for Stopwatch application.
1 public class Stopwatch extends AbstractWatchApplication
2 {
3 static final int a22_3324 = 1;
4 static final int a22_3621 = 2;
5 static final int a22_4857 = 3;
6 static final int d22_4302 = 4;
7 static final int d22_5403 = 5;
8
9 public METime startTime = new METime();
10 public METime stopTime = new METime();
11
12 public METime getstartTime()
13 {
14 return startTime;
15 }
16
17 public void setstartTime(METime t1)
18 {
19 startTime = t1;
20 }
21
22 public METime getstopTime()
23 {
24 return stopTime;
25 }
26
27 public void setstopTime(METime t1)
28 {
29 stopTime = t1;
33 {
33 {
34 super(master, "22_1039");
30 }
31
32 public Stopwatch(Master master)
35 addStateOop("Start [Watch]", "22_4743");
36 addStateOop("Running", "22_2650");
37 addStateOop("Stopped", "22_5338");
38 addStateOop("Stop [Watch]", "22_4800");
39
40 addTransition ("Stopped", "Down", a22_3324, "Stopped");
41 addTransition ("Running", "Up", a22_4857, "Stopped");
42 addTransition ("Stopped", "Up", a22_3621, "Running");
43 addTransition ("Stopped", "Mode", 0, "Stop [Watch]");
44 addTransition ("Running", "Mode", 0, "Stop [Watch]");
45 addTransition ("Start [Watch]", "", 0, "Stopped");
46
47 addStateDisplay("Running", -1, METime.
Pages:
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397