Class Symmetry010Chronology

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.time.chrono.Chronology>, java.time.chrono.Chronology

    public final class Symmetry010Chronology
    extends java.time.chrono.AbstractChronology
    implements java.io.Serializable
    The Symmetry010 calendar system.

    This chronology defines the rules of the Symmetry010 calendar system. Dates are aligned such that 0001/01/01 (Sym010) is 0001-01-01 (ISO).

    The calendar implemented by this class is proleptic, with January 1st as the start of the year. Each month either has 30 days or 31 days, in an alternating pattern; January has 30 days, February has 31 days and March again has 30 days. Due to this, each quarter consists of 13 weeks.

    Normal years thus have 364 days, whereas leap years have an extra week, aptly called leap week, added to the end, extending the year to 371 days. Thus, December in a leap year has 37 days.

    The fields are defined as follows:

    • era - Same eras as used in the Gregorian calendar: 'Before Common Era' (BCE) and 'Common Era' (CE).
    • year-of-era - The year-of-era for the current era increases uniformly from the epoch at year 1.
    • proleptic-year - The proleptic year is the same as the year-of-era for the current era.
    • month-of-year - There are 12 months in an Symmetry010 year, numbered from 1 to 12.
    • day-of-month - There are 30 days in a standard Symmetry010 month, numbered from 1 to 30, except for the middle-month in each quarter, which spans 31 days: February, May, August, November. In leap years, December has 37 days.
    • day-of-year - There are 364 days in a standard Symmetry010 year and 371 days in a leap year. The days are numbered accordingly.
    • leap-year - Leap years occur every 5 or 6 years, evenly spread over 293 years according the formula: (52 > ((52 * year + 146) % 293)).
    • Week day - every year and every quarter starts on a Monday. In each quarter, the first month starts on a Monday, the second month on a Wednesday and the 3rd on a Saturday. There are no days outside of the week or month.

    Implementation Requirements

    This class is immutable and thread-safe.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long DAYS_0001_TO_1970
      The number of days from year zero to CE 1970, still the era only allows CE 1 and higher.
      static Symmetry010Chronology INSTANCE
      Singleton instance for the Symmetry010 chronology.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Symmetry010Date date​(int prolepticYear, int month, int dayOfMonth)
      Obtains a local date in Symmetry010 calendar system from the proleptic-year, month-of-year and day-of-month fields.
      Symmetry010Date date​(java.time.chrono.Era era, int yearOfEra, int month, int dayOfMonth)
      Obtains a local date in Symmetry010 calendar system from the era, year-of-era, month-of-year and day-of-month fields.
      Symmetry010Date date​(java.time.temporal.TemporalAccessor temporal)
      Obtains a Symmetry010 local date from another date-time object.
      Symmetry010Date dateEpochDay​(long epochDay)
      Obtains a local date in the Symmetry010 calendar system from the epoch-day.
      Symmetry010Date dateNow()
      Obtains the current Symmetry010 local date from the system clock in the default time-zone.
      Symmetry010Date dateNow​(java.time.Clock clock)
      Obtains the current Symmetry010 local date from the specified clock.
      Symmetry010Date dateNow​(java.time.ZoneId zone)
      Obtains the current Symmetry010 local date from the system clock in the specified time-zone.
      Symmetry010Date dateYearDay​(int prolepticYear, int dayOfYear)
      Obtains a local date in Symmetry010 calendar system from the proleptic-year and day-of-year fields.
      Symmetry010Date dateYearDay​(java.time.chrono.Era era, int yearOfEra, int dayOfYear)
      Obtains a local date in Symmetry010 calendar system from the era, year-of-era and day-of-year fields.
      java.time.chrono.IsoEra eraOf​(int eraValue)
      Creates the chronology era object from the numeric value.
      java.util.List<java.time.chrono.Era> eras()
      Gets the list of eras for the chronology.
      java.lang.String getCalendarType()
      Gets the calendar type of the underlying calendar system, which returns null.
      java.lang.String getId()
      Gets the ID of the chronology - 'Sym010'.
      static long getLeapYearsBefore​(long prolepticYear)
      Get the count of leap years since CE 1.
      boolean isLeapYear​(long year)
      Checks if the specified year is a leap year.
      java.time.chrono.ChronoLocalDateTime<Symmetry010Date> localDateTime​(java.time.temporal.TemporalAccessor temporal)
      Obtains a Symmetry010 local date-time from another date-time object.
      int prolepticYear​(java.time.chrono.Era era, int yearOfEra)  
      java.time.temporal.ValueRange range​(java.time.temporal.ChronoField field)  
      java.time.chrono.ChronoZonedDateTime<Symmetry010Date> zonedDateTime​(java.time.Instant instant, java.time.ZoneId zone)
      Obtains a Symmetry010 zoned date-time in this chronology from an Instant.
      java.time.chrono.ChronoZonedDateTime<Symmetry010Date> zonedDateTime​(java.time.temporal.TemporalAccessor temporal)
      Obtains a Symmetry010 zoned date-time from another date-time object.
      • Methods inherited from class java.time.chrono.AbstractChronology

        compareTo, equals, hashCode, resolveDate, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.time.chrono.Chronology

        epochSecond, epochSecond, getDisplayName, period
    • Field Detail

      • INSTANCE

        public static final Symmetry010Chronology INSTANCE
        Singleton instance for the Symmetry010 chronology.
      • DAYS_0001_TO_1970

        public static final long DAYS_0001_TO_1970
        The number of days from year zero to CE 1970, still the era only allows CE 1 and higher. There are 6 full 293-year cycles from CE 1 to 1758, with 6 * 52 leap years, i.e. 312. There are 37 leap years from CE 1758 to 1970.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Symmetry010Chronology

        @Deprecated
        public Symmetry010Chronology()
        Deprecated.
        Use the singleton INSTANCE instead.
        Private constructor, that is public to satisfy the ServiceLoader.
    • Method Detail

      • getId

        public java.lang.String getId()
        Gets the ID of the chronology - 'Sym010'.

        The ID uniquely identifies the Chronology. It can be used to lookup the Chronology using Chronology.of(String).

        Specified by:
        getId in interface java.time.chrono.Chronology
        Returns:
        the chronology ID - 'Sym010'
        See Also:
        getCalendarType()
      • getCalendarType

        public java.lang.String getCalendarType()
        Gets the calendar type of the underlying calendar system, which returns null.

        The Unicode Locale Data Markup Language (LDML) specification does not define an identifier for this calendar system, thus null is returned.

        Specified by:
        getCalendarType in interface java.time.chrono.Chronology
        Returns:
        the calendar system type, null
        See Also:
        getId()
      • date

        public Symmetry010Date date​(java.time.chrono.Era era,
                                    int yearOfEra,
                                    int month,
                                    int dayOfMonth)
        Obtains a local date in Symmetry010 calendar system from the era, year-of-era, month-of-year and day-of-month fields.
        Specified by:
        date in interface java.time.chrono.Chronology
        Parameters:
        era - the Symmetry010 era, not null
        yearOfEra - the year-of-era
        month - the month-of-year
        dayOfMonth - the day-of-month
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
        java.lang.ClassCastException - if the era is not a IsoEra
      • date

        public Symmetry010Date date​(int prolepticYear,
                                    int month,
                                    int dayOfMonth)
        Obtains a local date in Symmetry010 calendar system from the proleptic-year, month-of-year and day-of-month fields.
        Specified by:
        date in interface java.time.chrono.Chronology
        Parameters:
        prolepticYear - the proleptic-year
        month - the month-of-year
        dayOfMonth - the day-of-month
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • dateYearDay

        public Symmetry010Date dateYearDay​(java.time.chrono.Era era,
                                           int yearOfEra,
                                           int dayOfYear)
        Obtains a local date in Symmetry010 calendar system from the era, year-of-era and day-of-year fields.
        Specified by:
        dateYearDay in interface java.time.chrono.Chronology
        Parameters:
        era - the Symmetry010 era, not null
        yearOfEra - the year-of-era
        dayOfYear - the day-of-year
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
        java.lang.ClassCastException - if the era is not a IsoEra
      • dateYearDay

        public Symmetry010Date dateYearDay​(int prolepticYear,
                                           int dayOfYear)
        Obtains a local date in Symmetry010 calendar system from the proleptic-year and day-of-year fields.
        Specified by:
        dateYearDay in interface java.time.chrono.Chronology
        Parameters:
        prolepticYear - the proleptic-year
        dayOfYear - the day-of-year
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • dateEpochDay

        public Symmetry010Date dateEpochDay​(long epochDay)
        Obtains a local date in the Symmetry010 calendar system from the epoch-day.
        Specified by:
        dateEpochDay in interface java.time.chrono.Chronology
        Parameters:
        epochDay - the epoch day
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • dateNow

        public Symmetry010Date dateNow()
        Obtains the current Symmetry010 local date from the system clock in the default time-zone.

        This will query the system clock in the default time-zone to obtain the current date.

        Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.

        Specified by:
        dateNow in interface java.time.chrono.Chronology
        Returns:
        the current Symmetry010 local date using the system clock and default time-zone, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • dateNow

        public Symmetry010Date dateNow​(java.time.ZoneId zone)
        Obtains the current Symmetry010 local date from the system clock in the specified time-zone.

        This will query the system clock to obtain the current date. Specifying the time-zone avoids dependence on the default time-zone.

        Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.

        Specified by:
        dateNow in interface java.time.chrono.Chronology
        Parameters:
        zone - the zone ID to use, not null
        Returns:
        the current Symmetry010 local date using the system clock, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • dateNow

        public Symmetry010Date dateNow​(java.time.Clock clock)
        Obtains the current Symmetry010 local date from the specified clock.

        This will query the specified clock to obtain the current date - today. Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using dependency injection.

        Specified by:
        dateNow in interface java.time.chrono.Chronology
        Parameters:
        clock - the clock to use, not null
        Returns:
        the current Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • date

        public Symmetry010Date date​(java.time.temporal.TemporalAccessor temporal)
        Obtains a Symmetry010 local date from another date-time object.
        Specified by:
        date in interface java.time.chrono.Chronology
        Parameters:
        temporal - the date-time object to convert, not null
        Returns:
        the Symmetry010 local date, not null
        Throws:
        java.time.DateTimeException - if unable to create the date
      • localDateTime

        public java.time.chrono.ChronoLocalDateTime<Symmetry010Date> localDateTime​(java.time.temporal.TemporalAccessor temporal)
        Obtains a Symmetry010 local date-time from another date-time object.
        Specified by:
        localDateTime in interface java.time.chrono.Chronology
        Parameters:
        temporal - the date-time object to convert, not null
        Returns:
        the Symmetry010 local date-time, not null
        Throws:
        java.time.DateTimeException - if unable to create the date-time
      • zonedDateTime

        public java.time.chrono.ChronoZonedDateTime<Symmetry010Date> zonedDateTime​(java.time.temporal.TemporalAccessor temporal)
        Obtains a Symmetry010 zoned date-time from another date-time object.
        Specified by:
        zonedDateTime in interface java.time.chrono.Chronology
        Parameters:
        temporal - the date-time object to convert, not null
        Returns:
        the Symmetry010 zoned date-time, not null
        Throws:
        java.time.DateTimeException - if unable to create the date-time
      • zonedDateTime

        public java.time.chrono.ChronoZonedDateTime<Symmetry010Date> zonedDateTime​(java.time.Instant instant,
                                                                                   java.time.ZoneId zone)
        Obtains a Symmetry010 zoned date-time in this chronology from an Instant.
        Specified by:
        zonedDateTime in interface java.time.chrono.Chronology
        Parameters:
        instant - the instant to create the date-time from, not null
        zone - the time-zone, not null
        Returns:
        the Symmetry010 zoned date-time, not null
        Throws:
        java.time.DateTimeException - if the result exceeds the supported range
      • isLeapYear

        public boolean isLeapYear​(long year)
        Checks if the specified year is a leap year.

        A leap-year is a year of a longer length than normal. Leap years in the calendar system match those of the ISO calendar system.

        Specified by:
        isLeapYear in interface java.time.chrono.Chronology
        Parameters:
        year - the proleptic-year to check, not validated for range
        Returns:
        true if the year is a leap year
      • eraOf

        public java.time.chrono.IsoEra eraOf​(int eraValue)
        Creates the chronology era object from the numeric value.

        The list of eras is shared with IsoEra.

        Specified by:
        eraOf in interface java.time.chrono.Chronology
        Parameters:
        eraValue - the era value
        Returns:
        the calendar system era, not null
        Throws:
        java.time.DateTimeException - if unable to create the era
      • eras

        public java.util.List<java.time.chrono.Era> eras()
        Gets the list of eras for the chronology.

        The list of eras is shared with IsoEra.

        Specified by:
        eras in interface java.time.chrono.Chronology
        Returns:
        the list of eras for the chronology, may be immutable, not null
      • range

        public java.time.temporal.ValueRange range​(java.time.temporal.ChronoField field)
        Specified by:
        range in interface java.time.chrono.Chronology
      • prolepticYear

        public int prolepticYear​(java.time.chrono.Era era,
                                 int yearOfEra)
        Specified by:
        prolepticYear in interface java.time.chrono.Chronology
      • getLeapYearsBefore

        public static long getLeapYearsBefore​(long prolepticYear)
        Get the count of leap years since CE 1.
        Parameters:
        prolepticYear - the year
        Returns:
        the number of leap years since CE 1