Package com.ibm.icu.util
Class TimeArrayTimeZoneRule
java.lang.Object
com.ibm.icu.util.TimeZoneRule
com.ibm.icu.util.TimeArrayTimeZoneRule
- All Implemented Interfaces:
Serializable
TimeArrayTimeZoneRule
represents a time zone rule whose start times are
defined by an array of milliseconds since the standard base time.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTimeArrayTimeZoneRule
(String name, int rawOffset, int dstSavings, long[] startTimes, int timeType) Constructs aTimeArrayTimeZoneRule
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
Modifier and TypeMethodDescriptiongetFinalStart
(int prevRawOffset, int prevDSTSavings) Gets the final time when this rule takes effect.getFirstStart
(int prevRawOffset, int prevDSTSavings) Gets the very first time when this rule takes effect.getNextStart
(long base, int prevOffset, int prevDSTSavings, boolean inclusive) Gets the first time when this rule takes effect after the specified time.getPreviousStart
(long base, int prevOffset, int prevDSTSavings, boolean inclusive) Gets the most recent time when this rule takes effect before the specified time.long[]
Gets the array of start times used by this rule.int
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
Returns if thisTimeZoneRule
has one or more start times.toString()
Returns aString
representation of thisTimeArrayTimeZoneRule
object.Methods inherited from class com.ibm.icu.util.TimeZoneRule
getDSTSavings, getName, getRawOffset
-
Constructor Details
-
TimeArrayTimeZoneRule
public TimeArrayTimeZoneRule(String name, int rawOffset, int dstSavings, long[] startTimes, int timeType) Constructs aTimeArrayTimeZoneRule
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 ofDataTimeRule.WALL_TIME
,STANDARD_TIME
andUTC_TIME
.
-
-
Method Details
-
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).
-
getTimeType
public int getTimeType()Gets the time type of the start times used by this rule. The return value is eitherDateTimeRule.WALL_TIME
orDateTimeRule.STANDARD_TIME
orDateTimeRule.UTC_TIME
.- Returns:
- The time type used of the start times used by this rule.
-
getFirstStart
Gets the very first time when this rule takes effect.- Specified by:
getFirstStart
in classTimeZoneRule
- 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.
-
getFinalStart
Gets the final time when this rule takes effect.- Specified by:
getFinalStart
in classTimeZoneRule
- 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.
-
getNextStart
Gets the first time when this rule takes effect after the specified time.- Specified by:
getNextStart
in classTimeZoneRule
- 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.
-
getPreviousStart
Gets the most recent time when this rule takes effect before the specified time.- Specified by:
getPreviousStart
in classTimeZoneRule
- 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.
-
isEquivalentTo
Returns if this rule represents the same rule and offsets as another. When twoTimeZoneRule
objects differ only its names, this method returns true.- Overrides:
isEquivalentTo
in classTimeZoneRule
- Parameters:
other
- TheTimeZoneRule
object to be compared with.- Returns:
- true if the other
TimeZoneRule
is the same as this one.
-
isTransitionRule
public boolean isTransitionRule()Returns if thisTimeZoneRule
has one or more start times.
Note: This method inTimeArrayTimeZoneRule
always returns true.- Specified by:
isTransitionRule
in classTimeZoneRule
- Returns:
- true if this
TimeZoneRule
has one or more start times.
-
toString
Returns aString
representation of thisTimeArrayTimeZoneRule
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 classTimeZoneRule
-