While as novices
in both Java and the time domain, writing this class required more effort than it
should have, it was still completed in around half the time we had spent ?¬?ghting with
the Java Date class.
The main value of METime is that it has remained unaffected by the signi?¬?cant
changes to time and date handling in Java over the subsequent JDK versions. It also
helped us to cope when the domain revealed surprising complexity. For instance, a
World Time application works so that it shows the current local time plus a userde
?¬?ned offset. When editing theWorld Time, the time displayed is the local time plus
the offset, but the changes made while editing only affect the offset. Time units thus
roll over when the local time plus the offset reaches the maximum value. If the offset is
??6 hours, the local hours value equals 17, and the user increments the hours, the
displayed ?¬?gure must decrease from 23 to 0, but the offset must increase to??7; not for
instance to 17, which has the same value modulo 24, but a very different effect on
any existing timer alarms that might be counting down.
12.2.2 Extending a Framework from One Platform to Many
As we saw in Chapter 9, theWatch example was designed and built purely to run as
a Java applet in a standard desktop OS. When we decided to extend it to work as a
Java application in a cell phone, many of the initial assumptions were no longer
true.
Pages:
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592