|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.TimeZone
com.sun.cldc.util.TimeZoneImplementation
com.sun.cldc.util.j2me.TimeZoneImpl
public class TimeZoneImpl
This class provides the time zone implementations for J2ME CLDC/MIDP. By default, the only supported time zone is UTC/GMT. Vendor-specific implementations may provide additional time zones.
For Sun SPOTs the following additional time zones are supported:
HST, AST, PST, MST, CST & EST and "GMT+hh:mm"plus we allow other timezones to be user defined via system properties passed in to Squawk on the command line.
The default time zone is "PST". It can be changed to another supported
time zone by setting the system property
com.sun.cldc.util.j2me.TimeZoneImpl.timezone
E.g. to make the default be "EST" include the following in the command line
to start Squawk:
-Dcom.sun.cldc.util.j2me.TimeZoneImpl.timezone=EST
To add additional time zones use the system property
com.sun.cldc.util.j2me.TimeZoneImpl.additionaltimezones
,
where its value is a list of the time zones to add in the format:
tzname1={+-}hh{:mm}{,daylight_savings_spec};tzname2=...;where
daylight_savings_spec = start_month,start_day,start_day_of_week,start_time, end_month,end_day,end_day_of_week,end_time,hh{:mm}
To specify the last Sunday of the month set the day_of_week to Calendar.SUNDAY and the day to -1, i.e. day is interpreted then to be which Sunday (1 = first, 2 = second, -2 = second last, etc.).
It is also possible to specify a date such as the first Sunday before/after a given day of the month by setting the day_of_week to be negative. If the day value is negative then the day_of_week before that day is specified.
For example an Australian might define:
-Dcom.sun.cldc.util.j2me.TimeZoneImpl.additionaltimezones= Australia/Perth=8;Australia/Darwin=9:30;Australia/Adelaide=9:30,9,-1,1,2,2,-1,1,2,1; Australia/Brisbane=10;Australia/Sydney=10,9,-1,1,2,2,-1,1,3,1; Australia/Lord_Howe=10:30,9,-1,1,2,2,-1,1,3,0:30;
Refer to the time zone defining code at the end of this file for examples of the values to use, e.g.:
new TimeZoneImpl((int)(9.5*ONE_HOUR), "Australia/Adelaide", Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*ONE_HOUR, Calendar.MARCH, -1, Calendar.SUNDAY, 3*ONE_HOUR, 1*ONE_HOUR), // Rule AS 1987 max - Oct lastSun 2:00s 1:00 - // Rule AS 1995 max - Mar lastSun 2:00s 0 - // Australia/Adelaide South Australia(AU) 9:30 AS CST
TimeZone
Field Summary | |
---|---|
static String |
HOME_ID
|
Constructor Summary | |
---|---|
TimeZoneImpl()
|
Method Summary | |
---|---|
boolean |
equals(Object object)
Indicates whether some other object is "equal to" this one. |
String |
getID()
Gets the ID of this time zone. |
String[] |
getIDs()
Gets all the available IDs supported. |
TimeZone |
getInstance(String ID)
Gets the TimeZone for the given ID. |
int |
getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int millis)
Gets the time zone offset, for the specified date, modified in case of daylight savings. |
int |
getRawOffset()
Gets the GMT offset for this time zone. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
useDaylightTime()
Queries if this time zone uses Daylight Savings Time. |
Methods inherited from class java.util.TimeZone |
---|
getAvailableIDs, getDefault, getTimeZone |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String HOME_ID
Constructor Detail |
---|
public TimeZoneImpl()
Method Detail |
---|
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis)
getOffset
in class TimeZone
era
- The era of the given date (0 = BC, 1 = AD).year
- The year in the given date.month
- The month in the given date. Month is 0-based. e.g.,
0 for January.day
- The day-in-month of the given date.dayOfWeek
- The day-of-week of the given date.millis
- The milliseconds in day in standard local time.
IllegalArgumentException
- the era, month, day,
dayOfWeek, or millis parameters are out of rangepublic int getRawOffset()
getRawOffset
in class TimeZone
public boolean useDaylightTime()
useDaylightTime
in class TimeZone
public String getID()
getID
in class TimeZone
public TimeZone getInstance(String ID)
TimeZone
for the given ID.
getInstance
in class TimeZoneImplementation
ID
- the ID for a TimeZone
, either an abbreviation such as
"GMT", or a full name such as "America/Los_Angeles".
The only time zone ID that is required to be supported is "GMT", though typically, the timezones for the regions where the device is sold should be supported.
TimeZone
, or null if the given ID
cannot be understood.public String[] getIDs()
getIDs
in class TimeZoneImplementation
public boolean equals(Object object)
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y) consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.
equals
in class Object
object
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.hashCode()
,
Hashtable
public int hashCode()
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |