Enum Class JulianCalendar.Unit

java.lang.Object
java.lang.Enum<JulianCalendar.Unit>
net.time4j.calendar.JulianCalendar.Unit
All Implemented Interfaces:
Serializable, Comparable<JulianCalendar.Unit>, java.lang.constant.Constable, ChronoUnit
Enclosing class:
JulianCalendar

public static enum JulianCalendar.Unit extends Enum<JulianCalendar.Unit> implements ChronoUnit

Defines some calendar units for the Julian calendar.

Since:
3.15/4.12
  • Enum Constant Details

  • Method Details

    • values

      public static JulianCalendar.Unit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JulianCalendar.Unit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getLength

      public double getLength()
      Description copied from interface: ChronoUnit

      Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.

      Important note: This method can only yield an estimated value and is not intended to assist in calculations of durations, but only in sorting of units.

      Specified by:
      getLength in interface ChronoUnit
      Returns:
      estimated decimal value in seconds
    • isCalendrical

      public boolean isCalendrical()
      Description copied from interface: ChronoUnit

      Queries if this time unit is calendrical respective is at least as long as a calendar day.

      Implementation note: The method must be consistent with the typical length of the unit. The expression Double.compare(unit.getLength(), 86400.0) >= 0 is equivalent to unit.isCalendrical().

      Specified by:
      isCalendrical in interface ChronoUnit
      Returns:
      true if at least as long as a day else false
    • between

      public int between(JulianCalendar start, JulianCalendar end)

      Calculates the difference between given Julian dates in this unit.

      Note: Users can apply the alternative expression start.until(end, unit) for extreme ranges if the range of an int-primitive is not sufficient.

      Parameters:
      start - start date (inclusive)
      end - end date (exclusive)
      Returns:
      difference counted in this unit
      Throws:
      ArithmeticException - if the calculated result does not fit into an int
      Since:
      3.11/4.8