Class JucheCalendar

All Implemented Interfaces:
Serializable, Comparable<JucheCalendar>, CalendarDate, ChronoDisplay, Temporal<CalendarDate>, LocalizedPatternSupport

@CalendarType("juche") public final class JucheCalendar extends Calendrical<CalendarUnit,​JucheCalendar> implements LocalizedPatternSupport

The Juche calendar used in North Korea uses as only difference to western gregorian calendar a different year numbering with the Juche era 1912-01-01.

See also: Wikipedia.

Following elements which are declared as constants are registered by this class

Furthermore, all elements defined in EpochDays and CommonElements are supported.

Support for unicode ca-extensions

      Locale locale = Locale.forLanguageTag("en-u-ca-juche");
      ChronoFormatter<CalendarDate> f = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.FULL, locale);
      assertThat(
          f.format(PlainDate.of(2017, 10, 1)),
          is("Sunday, October 1, 106 Juche"));
 
Since:
3.40/4.35
Author:
Meno Hochschild
See Also:
Serialized Form
  • Field Details

  • Method Details

    • of

      public static JucheCalendar of(int yearOfEra, Month month, int dayOfMonth)

      Creates a new instance of a Juche calendar date.

      Parameters:
      yearOfEra - Juche year of era (>= 1)
      month - gregorian month
      dayOfMonth - day of month
      Returns:
      new instance of JucheCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • of

      public static JucheCalendar of(int yearOfEra, int month, int dayOfMonth)

      Creates a new instance of an Juche calendar date.

      Parameters:
      yearOfEra - Juche year of era (>= 1)
      month - gregorian month
      dayOfMonth - day of month
      Returns:
      new instance of MinguoCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • nowInSystemTime

      public static JucheCalendar nowInSystemTime()

      Obtains the current calendar date in system time.

      Convenient short-cut for: SystemClock.inLocalView().now(JucheCalendar.axis()).

      Returns:
      current calendar date in system time zone using the system clock
      See Also:
      SystemClock.inLocalView(), ZonalClock.now(net.time4j.engine.Chronology)
    • getEra

      public JucheEra getEra()

      Yields the Juche era.

      Returns:
      enum
    • getYear

      public int getYear()

      Yields the Juche year.

      Returns:
      int
    • getMonth

      public Month getMonth()

      Yields the (gregorian) month.

      Returns:
      enum
    • getDayOfMonth

      public int getDayOfMonth()

      Yields the day of month.

      Returns:
      int
    • getDayOfWeek

      public Weekday getDayOfWeek()

      Determines the day of week.

      Returns:
      Weekday
    • getDayOfYear

      public int getDayOfYear()

      Yields the day of year.

      Returns:
      int
    • lengthOfMonth

      public int lengthOfMonth()

      Yields the length of current month in days.

      Returns:
      int
    • lengthOfYear

      public int lengthOfYear()

      Yields the length of current year in days.

      Returns:
      int
    • isLeapYear

      public boolean isLeapYear()

      Is the year of this date a leap year?

      Returns:
      boolean
    • isValid

      public static boolean isValid(int yearOfEra, int month, int dayOfMonth)

      Queries if given parameter values form a well defined calendar date.

      Parameters:
      yearOfEra - the year of era to be checked
      month - the month to be checked
      dayOfMonth - the day of month to be checked
      Returns:
      true if valid else false
      See Also:
      of(int, int, int)
    • at

      Creates a new local timestamp with this date and given wall time.

      If the time T24:00 is used then the resulting timestamp will automatically be normalized such that the timestamp will contain the following day instead.

      Parameters:
      time - wall time
      Returns:
      general timestamp as composition of this date and given time
    • atTime

      public GeneralTimestamp<JucheCalendar> atTime(int hour, int minute)

      Is equivalent to at(PlainTime.of(hour, minute)).

      Parameters:
      hour - hour of day in range (0-24)
      minute - minute of hour in range (0-59)
      Returns:
      general timestamp as composition of this date and given time
      Throws:
      IllegalArgumentException - if any argument is out of range
    • equals

      public boolean equals(Object obj)
      Description copied from class: Calendrical

      Based on the epoch day number and the calendar system.

      In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.

      If an only temporal comparison is required then the method Calendrical.isSimultaneous(CalendarDate) is to be used.

      Overrides:
      equals in class Calendrical<CalendarUnit,​JucheCalendar>
      See Also:
      Chronology.getChronoType()
    • hashCode

      public int hashCode()
      Description copied from class: Calendrical

      Based on the epoch day number.

      Overrides:
      hashCode in class Calendrical<CalendarUnit,​JucheCalendar>
    • toString

      public String toString()
      Description copied from class: TimePoint

      Provides a complete textual representation of the state of this time point.

      The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).

      Specified by:
      toString in class TimePoint<CalendarUnit,​JucheCalendar>
    • getDefaultWeekmodel

      public static Weekmodel getDefaultWeekmodel()

      Obtains the standard week model of this calendar.

      The Juche calendar usually starts on Monday.

      Returns:
      Weekmodel
    • axis

      public static TimeAxis<CalendarUnit,​JucheCalendar> axis()

      Returns the associated time axis.

      Returns:
      chronology