As
this procedure varies between platforms, there is an individual version of this
subgenerator for each supported target platform. If there are any speci?¬?c platformrelated
generation requirements, for example creating theHTML?¬?les for the browserbased
test environment in Fig. 9.10, they can be integrated into the ???_create makefor *???
subgenerator.
The responsibility of the ???_Models??? and ???_Model??? subgenerators is to handle the
generation of code for theWatch Models, LogicalWatches, andWatch Applications.
For each Watch Model, three pieces of code are generated: an applet as the physical
implementation of the user interface, a display de?¬?nition to create the speci?¬?ed user
interface components, and the de?¬?nition of the logical watch.
An example of the code generated for an applet (produced by the ???_Applet???
subgenerator) is shown in Listing 9.1. The generated code de?¬?nes the applet as an
extension of the AbstractWatchApplet framework class and adds the initialization for
the new class. Values from the model are shown in bold.
FIGURE 9.10 The watch code generator architecture, part 1
CODE GENERATION FOR WATCH MODELS 213
Listing 9.1 Generated code for an applet.
public class Ace extends AbstractWatchApplet {
public Ace() {
master=new Master();
master.init(this,
new DisplayX334(),
new TASTW(master));
}
}
The simple generator that produced this is shown in Listing 9.
Pages:
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394