Package com.ibm.icu.util
Class AnnualTimeZoneRule
- java.lang.Object
-
- com.ibm.icu.util.TimeZoneRule
-
- com.ibm.icu.util.AnnualTimeZoneRule
-
- All Implemented Interfaces:
Serializable
public class AnnualTimeZoneRule extends TimeZoneRule
AnnualTimeZoneRuleis a class used for representing a time zone rule which takes effect annually. Years used in this class are all Gregorian calendar years.- See Also:
- Serialized Form
- Status:
- Stable ICU 3.8.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_YEARThe constant representing the maximum year used for designating a rule is permanent.
-
Constructor Summary
Constructors Constructor Description AnnualTimeZoneRule(String name, int rawOffset, int dstSavings, DateTimeRule dateTimeRule, int startYear, int endYear)Constructs aAnnualTimeZoneRulewith 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetEndYear()Gets the end year when this rule takes effect.DategetFinalStart(int prevRawOffset, int prevDSTSavings)Gets the final time when this rule takes effect.DategetFirstStart(int prevRawOffset, int prevDSTSavings)Gets the very first time when this rule takes effect.DategetNextStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)Gets the first time when this rule takes effect after the specified time.DategetPreviousStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)Gets the most recent time when this rule takes effect before the specified time.DateTimeRulegetRule()Gets the start date/time rule associated used by this rule.DategetStartInYear(int year, int prevRawOffset, int prevDSTSavings)Gets the time when this rule takes effect in the given year.intgetStartYear()Gets the first year when this rule takes effect.booleanisEquivalentTo(TimeZoneRule other)Returns if this rule represents the same rule and offsets as another.booleanisTransitionRule()Returns if thisTimeZoneRulehas one or more start times.StringtoString()Returns aStringrepresentation of thisAnnualTimeZoneRuleobject.-
Methods inherited from class com.ibm.icu.util.TimeZoneRule
getDSTSavings, getName, getRawOffset
-
-
-
-
Field Detail
-
MAX_YEAR
public static final int MAX_YEAR
The constant representing the maximum year used for designating a rule is permanent.- See Also:
- Constant Field Values
- Status:
- Stable ICU 3.8.
-
-
Constructor Detail
-
AnnualTimeZoneRule
public AnnualTimeZoneRule(String name, int rawOffset, int dstSavings, DateTimeRule dateTimeRule, int startYear, int endYear)
Constructs aAnnualTimeZoneRulewith 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.- Parameters:
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.- Status:
- Stable ICU 3.8.
-
-
Method Detail
-
getRule
public DateTimeRule getRule()
Gets the start date/time rule associated used by this rule.- Returns:
- An
AnnualDateTimeRulewhich represents the start date/time rule used by this time zone rule. - Status:
- Stable ICU 3.8.
-
getStartYear
public int getStartYear()
Gets the first year when this rule takes effect.- Returns:
- The start year of this rule. The year is in Gregorian calendar with 0 == 1 BCE, -1 == 2 BCE, etc.
- Status:
- Stable ICU 3.8.
-
getEndYear
public int getEndYear()
Gets the end year when this rule takes effect.- Returns:
- The end year of this rule (inclusive). The year is in Gregorian calendar with 0 == 1 BCE, -1 == 2 BCE, etc.
- Status:
- Stable ICU 3.8.
-
getStartInYear
public Date getStartInYear(int year, int prevRawOffset, int prevDSTSavings)
Gets the time when this rule takes effect in the given year.- Parameters:
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.- Returns:
- The time when this rule takes effect in the year, or null if this rule is not applicable in the year.
- 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:
getFirstStartin 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.
- Status:
- Stable ICU 3.8.
-
getFinalStart
public Date getFinalStart(int prevRawOffset, int prevDSTSavings)
Gets the final time when this rule takes effect.- Specified by:
getFinalStartin 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.
- Status:
- Stable ICU 3.8.
-
getNextStart
public Date getNextStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)
Gets the first time when this rule takes effect after the specified time.- Specified by:
getNextStartin classTimeZoneRule- Parameters:
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.- 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 prevRawOffset, int prevDSTSavings, boolean inclusive)
Gets the most recent time when this rule takes effect before the specified time.- Specified by:
getPreviousStartin classTimeZoneRule- Parameters:
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.- 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 twoTimeZoneRuleobjects differ only its names, this method returns true.- Overrides:
isEquivalentToin classTimeZoneRule- Parameters:
other- TheTimeZoneRuleobject to be compared with.- Returns:
- true if the other
TimeZoneRuleis the same as this one. - Status:
- Stable ICU 3.8.
-
isTransitionRule
public boolean isTransitionRule()
Returns if thisTimeZoneRulehas one or more start times.
Note: This method inAnnualTimeZoneRulealways returns true.- Specified by:
isTransitionRulein classTimeZoneRule- Returns:
- true if this
TimeZoneRulehas one or more start times. - Status:
- Stable ICU 3.8.
-
toString
public String toString()
Returns aStringrepresentation of thisAnnualTimeZoneRuleobject. This method is used for debugging purpose only. The string representation can be changed in future version of ICU without any notice.- Overrides:
toStringin classTimeZoneRule- Status:
- Stable ICU 3.8.
-
-