Class JulianChronology

All Implemented Interfaces:
Serializable

public final class JulianChronology extends BasicGJChronology
Implements a pure proleptic Julian calendar system, which defines every fourth year as leap. This implementation follows the leap year rule strictly, even for dates before 8 CE, where leap years were actually irregular. In the Julian calendar, year zero does not exist: 1 BCE is followed by 1 CE.

Although the Julian calendar did not exist before 45 BCE, this chronology assumes it did, thus it is proleptic. This implementation also fixes the start of the year at January 1.

JulianChronology is thread-safe and immutable.

Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • JulianChronology

      JulianChronology(Chronology base, Object param, int minDaysInFirstWeek)
      Restricted constructor
  • Method Details

    • adjustYearForSet

      static int adjustYearForSet(int year)
    • getInstanceUTC

      public static JulianChronology getInstanceUTC()
      Gets an instance of the JulianChronology. The time zone of the returned instance is UTC.
      Returns:
      a singleton UTC instance of the chronology
    • getInstance

      public static JulianChronology getInstance()
      Gets an instance of the JulianChronology in the default time zone.
      Returns:
      a chronology in the default time zone
    • getInstance

      public static JulianChronology getInstance(DateTimeZone zone)
      Gets an instance of the JulianChronology in the given time zone.
      Parameters:
      zone - the time zone to get the chronology in, null is default
      Returns:
      a chronology in the specified time zone
    • getInstance

      public static JulianChronology getInstance(DateTimeZone zone, int minDaysInFirstWeek)
      Gets an instance of the JulianChronology in the given time zone.
      Parameters:
      zone - the time zone to get the chronology in, null is default
      minDaysInFirstWeek - minimum number of days in first week of the year; default is 4
      Returns:
      a chronology in the specified time zone
    • readResolve

      private Object readResolve()
      Serialization singleton
    • withUTC

      public Chronology withUTC()
      Gets the Chronology in the UTC time zone.
      Specified by:
      withUTC in class BaseChronology
      Returns:
      the chronology in UTC
    • withZone

      public Chronology withZone(DateTimeZone zone)
      Gets the Chronology in a specific time zone.
      Specified by:
      withZone in class BaseChronology
      Parameters:
      zone - the zone to get the chronology in, null is default
      Returns:
      the chronology
      See Also:
    • getDateMidnightMillis

      long getDateMidnightMillis(int year, int monthOfYear, int dayOfMonth) throws IllegalArgumentException
      Description copied from class: BasicChronology
      Gets the milliseconds for a date at midnight.
      Overrides:
      getDateMidnightMillis in class BasicChronology
      Parameters:
      year - the year
      monthOfYear - the month
      dayOfMonth - the day
      Returns:
      the milliseconds
      Throws:
      IllegalArgumentException
    • isLeapYear

      boolean isLeapYear(int year)
      Description copied from class: BasicChronology
      Is the specified year a leap year?
      Specified by:
      isLeapYear in class BasicChronology
      Parameters:
      year - the year to test
      Returns:
      true if leap
    • calculateFirstDayOfYearMillis

      long calculateFirstDayOfYearMillis(int year)
      Description copied from class: BasicChronology
      Gets the millisecond value of the first day of the year.
      Specified by:
      calculateFirstDayOfYearMillis in class BasicChronology
      Returns:
      the milliseconds for the first of the year
    • getMinYear

      int getMinYear()
      Description copied from class: BasicChronology
      Gets the minimum supported year.
      Specified by:
      getMinYear in class BasicChronology
      Returns:
      the year
    • getMaxYear

      int getMaxYear()
      Description copied from class: BasicChronology
      Gets the maximum supported year.
      Specified by:
      getMaxYear in class BasicChronology
      Returns:
      the year
    • getAverageMillisPerYear

      long getAverageMillisPerYear()
      Description copied from class: BasicChronology
      Gets an average value for the milliseconds per year.
      Specified by:
      getAverageMillisPerYear in class BasicChronology
      Returns:
      the millis per year
    • getAverageMillisPerYearDividedByTwo

      long getAverageMillisPerYearDividedByTwo()
      Description copied from class: BasicChronology
      Gets an average value for the milliseconds per year, divided by two.
      Specified by:
      getAverageMillisPerYearDividedByTwo in class BasicChronology
      Returns:
      the millis per year divided by two
    • getAverageMillisPerMonth

      long getAverageMillisPerMonth()
      Description copied from class: BasicChronology
      Gets an average value for the milliseconds per month.
      Specified by:
      getAverageMillisPerMonth in class BasicChronology
      Returns:
      the millis per month
    • getApproxMillisAtEpochDividedByTwo

      long getApproxMillisAtEpochDividedByTwo()
      Description copied from class: BasicChronology
      Returns a constant representing the approximate number of milliseconds elapsed from year 0 of this chronology, divided by two. This constant must be defined as:
          (yearAtEpoch * averageMillisPerYear + millisOfYearAtEpoch) / 2
       
      where epoch is 1970-01-01 (Gregorian).
      Specified by:
      getApproxMillisAtEpochDividedByTwo in class BasicChronology
    • assemble

      protected void assemble(AssembledChronology.Fields fields)
      Description copied from class: AssembledChronology
      Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields. All unset fields default to unsupported instances.
      Overrides:
      assemble in class BasicChronology
      Parameters:
      fields - container of fields