Enum Class JapaneseCalendar.Unit
- All Implemented Interfaces:
- Enclosing class:
Defines some calendar units for the Japanese calendar.
Nested Class Summary
Enum Constant SummaryEnum ConstantDescriptionStandard unit for days.The fuzzy unit of a nengo respective era.The unit of a gregorian or lunisolar month.The Japanese calendar uses a 7-day-week.The unit of a gregorian or lunisolar year.
Method SummaryModifier and TypeMethodDescription
longCalculates the difference between given Japanese dates in this unit.
()Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.
()Queries if this time unit is calendrical respective is at least as long as a calendar day.
String name)(Returns the enum constant of this class with the specified name.
()Returns an array containing the constants of this enum class, in the order they are declared.
Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Enum Constant Details
ERASpublic static final JapaneseCalendar.Unit ERAS
The fuzzy unit of a nengo respective era.
Nengos have very different and unpredictable lengths. Time4J uses
Integer.MAX_VALUEas length to indicate this behaviour. If any nengo is one of the northern court (1332-1393) then it will first be converted to its southern court equivalent before applying any era arithmetics.
If necessary in case of addition, Time4J will adjust the smaller elements year-of-nengo, month-of-year and day-of-month such that they still fit within the context of the newly calculated nengo. However, the main purpose of this unit is to count the nengo distance between two Japanese dates.
YEARSpublic static final JapaneseCalendar.Unit YEARS
The unit of a gregorian or lunisolar year.
Note that lunisolar years sometimes consist of 13 instead of 12 months.
MONTHSpublic static final JapaneseCalendar.Unit MONTHS
The unit of a gregorian or lunisolar month.
Note: The month arithmetic is limited to amounts smaller than
ArithmeticExceptionwill be thrown.
WEEKSpublic static final JapaneseCalendar.Unit WEEKS
The Japanese calendar uses a 7-day-week.
DAYSpublic static final JapaneseCalendar.Unit DAYS
Standard unit for days.
- See Also:
valuespublic static JapaneseCalendar.Unit values()Returns an array containing the constants of this enum class, in the order they are declared.
- an array containing the constants of this enum class, in the order they are declared
valueOfReturns 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.)
getLengthpublic double getLength()Description copied from interface:
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.
isCalendricalpublic boolean isCalendrical()Description copied from interface:
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) >= 0is equivalent to
Calculates the difference between given Japanese dates in this unit.
start- start date (inclusive)
end- end date (exclusive)
- difference counted in this unit