All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.serializabletypes.TimeZone

java.lang.Object
   |
   +----JBMSTours.serializabletypes.TimeZone

public class TimeZone
extends Object
implements Serializable
Look at the Source.

This class represents a time zone. Each time zone is some number of hours from Greenwich Mean Time. Time zones also differ in when Daylight Savings Time starts and ends (and whether Daylight Savings Time is used at all in the time zone). In the northern hemisphere, Daylight Savings Time always starts on a lower-numbered month than it ends on, while in the southern hemisphere, Daylight Savings Time always starts on a higher-numbered month than it ends on, because it starts in winter and ends in spring of the next year. TimeZones are part of the City class (and are thus stored as part of City objects in the Cities table).


Constructor Index

 o TimeZone(double)
Creates a TimeZone with a given offset from Greenwich Mean Time, and no Daylight Savings Time.
 o TimeZone(double, double, String, String)
Creates a TimeZone with the given offset from Greenwich Mean Time, and a given Daylight Savings Time behavior.

Method Index

 o compareTo(Object)
This method allows a TimeZone object to be orderable within SQL-J statements.

Returns -1 if this object is "less than" the parameter, 1 if this object is "greater than" the parameter, and "0" if they are equal.

We have arbitrarily decided to order TimeZones by their Greenwich Mean Time offset (from high to low), and secondarily by their Daylight Savings Times Offsets.

 o equals(Object)
For correct equality comparisons.
 o getBeginDST()
 o getDSTGMTOffset()
 o getEndDST()
 o getGMTOffset()
 o getGMTOffset(Date)
Return the offset in hours between this time zone and Greenwich Mean Time on the given Date.
 o getTimeDifference(TimeZone, Date)
Return the difference in time zones, in hours, between this time zone and a given time zone on the given date.
 o hashCode()
 o showAllDSTZones(int)
Allows us to test DST settings for a given year.
 o toString()
Format this TimeZone as a String.

Constructors

 o TimeZone
 public TimeZone(double GMToff,
                 double DSTGMToff,
                 String beginTheDST,
                 String endTheDST)
Creates a TimeZone with the given offset from Greenwich Mean Time, and a given Daylight Savings Time behavior.

Parameters:
GMToff - Offset in hours from Greenwich Mean Time
DSTGMToff - Offset in hours from Greenwich Mean Time when Daylight Savings Time is in effect.
beginTheDST - A String code that represents when Daylight Savings Time begins. The possible values are:
      "FSA" - First Sunday in April
      "FSO" - First Sunday in October
      "SSO" - Second Sunday in October
      "SSM" - Second Sunday in March
      "SSF" - Second Sunday in February
      "FSS" - First Sunday in September
      "FSM15" - First Sunday on or after March 15
      "LSO" - Last Sunday in October
      "LSM" - Last Sunday in March
      "FSM" - First Sunday in May
      "TSO" - Third Sunday in October
      "TSS" - Third Sunday in September
      "FFM" - First Friday in May
      "LWS" - Last Wednesday in September
      "LSS" - Last Sunday in September
      "SSA" - Second Sunday in April
      "TSM" - Third Sunday in March
  
endTheDST - A String code that represents when Daylight Savings Time ends. See above for possible values.
 o TimeZone
 public TimeZone(double GMToff)
Creates a TimeZone with a given offset from Greenwich Mean Time, and no Daylight Savings Time.

Parameters:
GMToff - Offset in hours from Greenwich Mean Time

Methods

 o toString
 public String toString()
Format this TimeZone as a String.

Overrides:
toString in class Object
 o getGMTOffset
 public double getGMTOffset()
 o getDSTGMTOffset
 public double getDSTGMTOffset()
 o getBeginDST
 public String getBeginDST()
 o getEndDST
 public String getEndDST()
 o getGMTOffset
 public double getGMTOffset(Date theDate)
Return the offset in hours between this time zone and Greenwich Mean Time on the given Date. The offset can depend on whether the Date is in Daylight Savings Time.

Parameters:
theDate - The Date for which to return the number of hours between this time zone and Greenwich Mean Time.
 o getTimeDifference
 public double getTimeDifference(TimeZone tzb,
                                 Date anyDate)
Return the difference in time zones, in hours, between this time zone and a given time zone on the given date. Returns a positive number if the passed-in TimeZone is LATER, and a negative if the passed-in TimeZone is earlier.

Parameters:
tzb - The time zone for which we want to know how many hours difference there are with this time zone.
tzDate - The date on which we are interested in the hours difference. The difference can depend on whether one time zone is in Daylight Savings Time and the other time zone is not.
 o showAllDSTZones
 public static void showAllDSTZones(int year)
Allows us to test DST settings for a given year.

Parameters:
year - The given year (see description above).
 o compareTo
 public int compareTo(Object o) throws ClassCastException
This method allows a TimeZone object to be orderable within SQL-J statements.

Returns -1 if this object is "less than" the parameter, 1 if this object is "greater than" the parameter, and "0" if they are equal.

We have arbitrarily decided to order TimeZones by their Greenwich Mean Time offset (from high to low), and secondarily by their Daylight Savings Times Offsets.

Returns:
int -1, 0, or 1.
Throws: ClassCastException
Thrown if the objects cannot be compared.
See Also:
City
 o equals
 public boolean equals(Object o)
For correct equality comparisons. Returns true if the two objects are "equal".

Overrides:
equals in class Object
 o hashCode
 public int hashCode()
Overrides:
hashCode in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index