Class EastAsianCalendar<U,D extends EastAsianCalendar<U,D>>
- All Implemented Interfaces:
Serializable
,Comparable<D>
,CalendarDate
,ChronoDisplay
,Temporal<CalendarDate>
- Direct Known Subclasses:
ChineseCalendar
,KoreanCalendar
,VietnameseCalendar
Base class of all calendars which are derivates of the lunisolar rural calendar invented in China.
The underlying calendrical algorithms are based on the astronomical formula of Jean Meeus and the book "Calendrical Calculations" by Dershowitz/Reingold. The differences between the concrete subclasses are mainly limited to the supported date range and the geographical meridian defining the timezone offset for evaluating the astronomical data.
- Since:
- 3.40/4.35
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new local timestamp with this date and given wall time.atTime(int hour, int minute)
Is equivalent toat(PlainTime.of(hour, minute))
.boolean
Based on the epoch day number and the calendar system.Tries to obtain the leap month of the calendar year associated with this calendar date.int
Yields the day of month in the range1-29/30
.Determines the day of week.int
Yields the day of year.long
Counts the elapsed days since UTC epoch.getMonth()
Yields the (lunar) month including the numerical value and the possible leap month flag.Obtains the sexagesimal name of day component which repeats every 60th day.Obtains the sexagesimal name of solar month component which repeats every 60th solar term.Obtains the solar term as one of 24 on the ecliptic of the sun.getYear()
Obtains the cyclic year (using a sexagesimal cycle).int
hashCode()
Based on the epoch day number.boolean
Is the year of this date a leap year such that it contains a leap month?int
Yields the length of current month in days.int
Yields the length of current year in days.toString()
Provides a complete textual representation of the state of this time point.Obtains the calendar date of the begin of next leap month.Methods inherited from class net.time4j.engine.Calendrical
compareTo, isAfter, isBefore, isSimultaneous, minus, plus
Methods inherited from class net.time4j.engine.TimePoint
max, min, minus, minus, plus, plus, until, until
Methods inherited from class net.time4j.engine.ChronoEntity
contains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, with
Methods inherited from interface net.time4j.engine.CalendarDate
transform, transform, transform, transform, transform, transform
Methods inherited from interface net.time4j.engine.Temporal
isAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqual
-
Method Details
-
getYear
Obtains the cyclic year (using a sexagesimal cycle).
- Returns:
- CyclicYear
-
getSolarTerm
Obtains the solar term as one of 24 on the ecliptic of the sun.
- Returns:
- SolarTerm
-
getMonth
Yields the (lunar) month including the numerical value and the possible leap month flag.
- Returns:
- EastAsianMonth
-
getDayOfMonth
public int getDayOfMonth()Yields the day of month in the range
1-29/30
.- Returns:
- int
-
getDayOfWeek
Determines the day of week.
- Returns:
- Weekday
-
getDayOfYear
public int getDayOfYear()Yields the day of year.
- Returns:
- int
>= 1
-
getSexagesimalMonth
Obtains the sexagesimal name of solar month component which repeats every 60th solar term.
- Returns:
- SexagesimalName
- Since:
- 5.7
- See Also:
getSolarTerm()
-
getSexagesimalDay
Obtains the sexagesimal name of day component which repeats every 60th day.
- Returns:
- SexagesimalName
- Since:
- 5.7
-
isLeapYear
public boolean isLeapYear()Is the year of this date a leap year such that it contains a leap month?
- Returns:
- boolean
- See Also:
findLeapMonth()
,withBeginOfNextLeapMonth()
-
findLeapMonth
Tries to obtain the leap month of the calendar year associated with this calendar date.
Note: If the current year is a leap year then it is possible that the found leap month is before the current calendar date.
- Returns:
- optional East Asian month as leap month of current calendar year
- Since:
- 5.8
- See Also:
isLeapYear()
,withBeginOfNextLeapMonth()
-
withBeginOfNextLeapMonth
Obtains the calendar date of the begin of next leap month.
Example:
ChineseCalendar cc = ChineseCalendar.ofNewYear(2018); cc = cc.withBeginOfNextLeapMonth(); System.out.println(cc); // chinese[geng-zi(2020)-*4-01]
- Returns:
- the calendar date when the next leap month starts
- Throws:
IllegalArgumentException
- if the next leap month is out of range of supported calendar dates- Since:
- 5.8
- See Also:
isLeapYear()
,findLeapMonth()
-
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
-
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
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- See Also:
at(PlainTime)
-
getDaysSinceEpochUTC
public long getDaysSinceEpochUTC()Description copied from interface:CalendarDate
Counts the elapsed days since UTC epoch.
- Specified by:
getDaysSinceEpochUTC
in interfaceCalendarDate
- Overrides:
getDaysSinceEpochUTC
in classCalendrical<U,D extends EastAsianCalendar<U,D>>
- Returns:
- count of days relative to UTC epoch [1972-01-01]
- See Also:
EpochDays.UTC
-
equals
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 classCalendrical<U,D extends EastAsianCalendar<U,D>>
- See Also:
Chronology.getChronoType()
-
hashCode
public int hashCode()Description copied from class:Calendrical
Based on the epoch day number.
- Overrides:
hashCode
in classCalendrical<U,D extends EastAsianCalendar<U,D>>
-
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).
-