com.ibm.icu.util
Class TimeArrayTimeZoneRule

java.lang.Object
  extended by com.ibm.icu.util.TimeZoneRule
      extended by com.ibm.icu.util.TimeArrayTimeZoneRule
All Implemented Interfaces:
Serializable

public class TimeArrayTimeZoneRule
extends TimeZoneRule

TimeArrayTimeZoneRule represents a time zone rule whose start times are defined by an array of milliseconds since the standard base time.

See Also:
Serialized Form
Status:
Stable ICU 3.8.

Constructor Summary
TimeArrayTimeZoneRule(String name, int rawOffset, int dstSavings, long[] startTimes, int timeType)
          Constructs a TimeArrayTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment and the array of times when this rule takes effect.
 
Method Summary
 Date getFinalStart(int prevRawOffset, int prevDSTSavings)
          Gets the final time when this rule takes effect.
 Date getFirstStart(int prevRawOffset, int prevDSTSavings)
          Gets the very first time when this rule takes effect.
 Date getNextStart(long base, int prevOffset, int prevDSTSavings, boolean inclusive)
          Gets the first time when this rule takes effect after the specified time.
 Date getPreviousStart(long base, int prevOffset, int prevDSTSavings, boolean inclusive)
          Gets the most recent time when this rule takes effect before the specified time.
 long[] getStartTimes()
          Gets the array of start times used by this rule.
 int getTimeType()
          Gets the time type of the start times used by this rule.
 boolean isEquivalentTo(TimeZoneRule other)
          Returns if this rule represents the same rule and offsets as another.
 boolean isTransitionRule()
          Returns if this TimeZoneRule has one or more start times.
 String toString()
          Returns a String representation of this TimeArrayTimeZoneRule object.
 
Methods inherited from class com.ibm.icu.util.TimeZoneRule
getDSTSavings, getName, getRawOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeArrayTimeZoneRule

public TimeArrayTimeZoneRule(String name,
                             int rawOffset,
                             int dstSavings,
                             long[] startTimes,
                             int timeType)
Constructs a TimeArrayTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment and the array of times when this rule takes effect.

Parameters:
name - The time zone name.
rawOffset - The UTC offset of its standard time in milliseconds.
dstSavings - The amount of daylight saving offset adjustment in milliseconds. If this ia a rule for standard time, the value of this argument is 0.
startTimes - The start times in milliseconds since the base time (January 1, 1970, 00:00:00).
timeType - The time type of the start times, which is one of DataTimeRule.WALL_TIME, STANDARD_TIME and UTC_TIME.
Status:
Stable ICU 3.8.
Method Detail

getStartTimes

public long[] getStartTimes()
Gets the array of start times used by this rule.

Returns:
An array of the start times in milliseconds since the base time (January 1, 1970, 00:00:00 GMT).
Status:
Stable ICU 3.8.

getTimeType

public int getTimeType()
Gets the time type of the start times used by this rule. The return value is either DateTimeRule.WALL_TIME or DateTimeRule.STANDARD_TIME or DateTimeRule.UTC_TIME.

Returns:
The time type used of the start times used by this rule.
Status:
Stable ICU 3.8.

getFirstStart

public Date getFirstStart(int prevRawOffset,
                          int prevDSTSavings)
Gets the very first time when this rule takes effect.

Specified by:
getFirstStart in class TimeZoneRule
Parameters:
prevRawOffset - The standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavings - The amount of daylight saving offset from the standard time.
Returns:
The very first time when this rule takes effect.
Status:
Stable ICU 3.8.

getFinalStart

public Date getFinalStart(int prevRawOffset,
                          int prevDSTSavings)
Gets the final time when this rule takes effect.

Specified by:
getFinalStart in class TimeZoneRule
Parameters:
prevRawOffset - The standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavings - The amount of daylight saving offset from the standard time.
Returns:
The very last time when this rule takes effect, or null if this rule is applied for future dates infinitely.
Status:
Stable ICU 3.8.

getNextStart

public Date getNextStart(long base,
                         int prevOffset,
                         int prevDSTSavings,
                         boolean inclusive)
Gets the first time when this rule takes effect after the specified time.

Specified by:
getNextStart in class TimeZoneRule
Parameters:
base - The first time after this time is returned.
prevOffset - The standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavings - The amount of daylight saving offset from the standard time.
inclusive - Whether the base time is inclusive or not.
Returns:
The first time when this rule takes effect after the specified time, or null when this rule never takes effect after the specified time.
Status:
Stable ICU 3.8.

getPreviousStart

public Date getPreviousStart(long base,
                             int prevOffset,
                             int prevDSTSavings,
                             boolean inclusive)
Gets the most recent time when this rule takes effect before the specified time.

Specified by:
getPreviousStart in class TimeZoneRule
Parameters:
base - The most recent time when this rule takes effect before this time is returned.
prevOffset - The standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavings - The amount of daylight saving offset from the standard time.
inclusive - Whether the base time is inclusive or not.
Returns:
The most recent time when this rule takes effect before the specified time, or null when this rule never takes effect before the specified time.
Status:
Stable ICU 3.8.

isEquivalentTo

public boolean isEquivalentTo(TimeZoneRule other)
Returns if this rule represents the same rule and offsets as another. When two TimeZoneRule objects differ only its names, this method returns true.

Overrides:
isEquivalentTo in class TimeZoneRule
Parameters:
other - The TimeZoneRule object to be compared with.
Returns:
true if the other TimeZoneRule is the same as this one.
Status:
Stable ICU 3.8.

isTransitionRule

public boolean isTransitionRule()
Returns if this TimeZoneRule has one or more start times.

Note: This method in TimeArrayTimeZoneRule always returns true.

Specified by:
isTransitionRule in class TimeZoneRule
Returns:
true if this has one or more start times.
Status:
Stable ICU 3.8.

toString

public String toString()
Returns a String representation of this TimeArrayTimeZoneRule object. This method is used for debugging purpose only. The string representation can be changed in future version of ICU without any notice.

Overrides:
toString in class TimeZoneRule
Status:
Stable ICU 3.8.


Copyright (c) 2011 IBM Corporation and others.