The middle level is the core of the framework, providing the basic building
blocks for watch models in the form of abstract superclass ???templates.??? The top level
provides the interface of the framework with the models by de?¬?ning the expected code
generation output, which complies with the code and the templates provided by the
other levels.
PLATFORM INTERFACE
AbstractWatchApplication
METime Alarm
Master
AbstractDisplay
WatchCanvas
AbstractWatchApplet
MODEL INTERFACE (GENERATED)
C
O
R
E
Ace TASTW DisplayX334 Stopwatch
FIGURE 9.12 The watch domain framework
THE DOMAIN FRAMEWORK 221
There are two kinds of classes on the lowest level of our framework. METime and
Alarm were implemented to raise the level of abstraction on the code level by hiding
platform complexity. For example, the implementation of alarm services utilizes a
fairly complex thread-based Java implementation. To hide this complexity, class
Alarm implements a simple service interface for setting and stopping alarms, and all
references from the code generator to alarms are de?¬?ned using this interface.
Similarly, METime makes up for the shortcomings of the implementation of date and
time functions in the Java version used. During the code generation, when we need to
set an alarm or apply an arithmetic operation on a time unit, the code generator
produces a simple dispatch call to the services provided by these two classes.
Pages:
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403