public class AnnualTimeZoneRule extends TimeZoneRule
AnnualTimeZoneRule
is a class used for representing a time zone
rule which takes effect annually. Years used in this class are
all Gregorian calendar years.Modifier and Type | Field and Description |
---|---|
static int |
MAX_YEAR
The constant representing the maximum year used for designating a rule is permanent.
|
Constructor and Description |
---|
AnnualTimeZoneRule(String name,
int rawOffset,
int dstSavings,
DateTimeRule dateTimeRule,
int startYear,
int endYear)
Constructs a
AnnualTimeZoneRule with the name, the GMT offset of its
standard time, the amount of daylight saving offset adjustment,
the annual start time rule and the start/until years. |
Modifier and Type | Method and Description |
---|---|
int |
getEndYear()
Gets the end year when this rule takes effect.
|
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 prevRawOffset,
int prevDSTSavings,
boolean inclusive)
Gets the first time when this rule takes effect after the specified time.
|
Date |
getPreviousStart(long base,
int prevRawOffset,
int prevDSTSavings,
boolean inclusive)
Gets the most recent time when this rule takes effect before the specified time.
|
DateTimeRule |
getRule()
Gets the start date/time rule associated used by this rule.
|
Date |
getStartInYear(int year,
int prevRawOffset,
int prevDSTSavings)
Gets the time when this rule takes effect in the given year.
|
int |
getStartYear()
Gets the first year when this rule takes effect.
|
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 AnnualTimeZoneRule object. |
getDSTSavings, getName, getRawOffset
public static final int MAX_YEAR
public AnnualTimeZoneRule(String name, int rawOffset, int dstSavings, DateTimeRule dateTimeRule, int startYear, int endYear)
AnnualTimeZoneRule
with the name, the GMT offset of its
standard time, the amount of daylight saving offset adjustment,
the annual start time rule and the start/until years.name
- The time zone name.rawOffset
- The GMT 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.dateTimeRule
- The start date/time rule repeated annually.startYear
- The first year when this rule takes effect.endYear
- The last year when this rule takes effect. If this
rule is effective forever in future, specify MAX_YEAR.public DateTimeRule getRule()
AnnualDateTimeRule
which represents the start date/time
rule used by this time zone rule.public int getStartYear()
public int getEndYear()
public Date getStartInYear(int year, int prevRawOffset, int prevDSTSavings)
year
- The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.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 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 prevRawOffset, int prevDSTSavings, boolean inclusive)
getNextStart
in class TimeZoneRule
base
- The first time after this time is returned.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.inclusive
- Whether the base time is inclusive or not.public Date getPreviousStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)
getPreviousStart
in class TimeZoneRule
base
- The most recent time when this rule takes effect before
this time is returned.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.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.AnnualTimeZoneRule
always returns true.isTransitionRule
in class TimeZoneRule
TimeZoneRule
has one or more start times.public String toString()
String
representation of this AnnualTimeZoneRule
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.