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.Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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. |
getDSTSavings, getName, getRawOffset
public TimeArrayTimeZoneRule(String name, int rawOffset, int dstSavings, long[] startTimes, int timeType)
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.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
.public long[] getStartTimes()
public int getTimeType()
DateTimeRule.WALL_TIME
or DateTimeRule.STANDARD_TIME
or DateTimeRule.UTC_TIME
.public Date getFirstStart(int prevRawOffset, int prevDSTSavings)
getFirstStart
in class TimeZoneRule
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.public Date getFinalStart(int prevRawOffset, int prevDSTSavings)
getFinalStart
in class TimeZoneRule
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.public Date getNextStart(long base, int prevOffset, int prevDSTSavings, boolean inclusive)
getNextStart
in class TimeZoneRule
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.public Date getPreviousStart(long base, int prevOffset, int prevDSTSavings, boolean inclusive)
getPreviousStart
in class TimeZoneRule
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.public boolean isEquivalentTo(TimeZoneRule other)
TimeZoneRule
objects differ only its names, this method returns
true.isEquivalentTo
in class TimeZoneRule
other
- The TimeZoneRule
object to be compared with.TimeZoneRule
is the same as this one.public boolean isTransitionRule()
TimeZoneRule
has one or more start times.TimeArrayTimeZoneRule
always returns true.isTransitionRule
in class TimeZoneRule
TimeZoneRule
has one or more start times.public String toString()
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.toString
in class TimeZoneRule
Copyright © 2016 Unicode, Inc. and others.