Class DaylightSavingRule

java.lang.Object
net.time4j.tz.model.DaylightSavingRule
Direct Known Subclasses:
GregorianTimezoneRule

public abstract class DaylightSavingRule extends Object

Defines a yearly pattern when and how there is a switch from winter to summer time and vice versa.

This rule describes when such a switch happens. It also determines the DST-offset. For every rule instance, a ZonalTransition can be created just by indicating the appropriate year and standard offset. The change from winter to summer time and back is usually expressed by two rule instances.

Note: The term "year" denotes the year in any calendar which is not necessarily the gregorian one. Subclasses need to define the calendar type and some calendar-specific year conversions. If subclasses also want to be serializable then they have to apply the serialization proxy pattern described by Joshua Bloch.

Since:
2.2
Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract PlainDate
    getDate​(int year)
    Determines the date of time switch dependent on given year.
    Yields the offset indicator which must be consulted when interpreting the date and time of time switch in terms of UTC.
    int
    Yields the daylight saving amount after the time switch in seconds.
    Determines the clock time when the switch from winter time to summer time happens or vice versa.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getDate

      public abstract PlainDate getDate(int year)

      Determines the date of time switch dependent on given year.

      The result must be interpreted by mean of getIndicator() in order to calculate the UTC date.

      Parameters:
      year - reference year when a time switch happens
      Returns:
      calendar date of time switch
      Throws:
      IllegalArgumentException - if given year does not fit to this rule
      Since:
      2.2
    • getTimeOfDay

      public final PlainTime getTimeOfDay()

      Determines the clock time when the switch from winter time to summer time happens or vice versa.

      The result must be interpreted by mean of getIndicator() in order to calculate the UTC time.

      Returns:
      clock time of time switch in second precision
      Since:
      2.2
    • getIndicator

      public final OffsetIndicator getIndicator()

      Yields the offset indicator which must be consulted when interpreting the date and time of time switch in terms of UTC.

      Returns:
      OffsetIndicator
      Since:
      2.2
    • getSavings

      public final int getSavings()

      Yields the daylight saving amount after the time switch in seconds.

      Important: This offset is not always positive but can also be zero or even negative.

      Returns:
      DST-Offset in seconds (without standard offset)
      Since:
      2.2