Class HistoricDate
- All Implemented Interfaces:
Comparable<HistoricDate>
Defines a historic date which consists of era, year of era, month and day of month.
Instances of this class are agnostic of any specific new-year-strategy other than the
default (first of January)
but can use such a strategy
as parameter to determine the real historic year
for display purposes.
The natural order is based on the timeline order.
- Since:
- 3.0
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo(HistoricDate other)
boolean
int
Yields the historic day of month.getEra()
Yields the historic era.int
getMonth()
Yields the historic month.int
Yields the year of the historic era starting on January the first.int
getYearOfEra(NewYearStrategy newYearStrategy)
Yields the displayed historic year whose begin is determined by given new-year-strategy.int
hashCode()
static HistoricDate
of(HistoricEra era, int yearOfEra, int month, int dom)
Equivalent toHistoricDate.of(era, yearOfEra, month, dom, YearDefinition.DUAL_DATING, NewYearRule.BEGIN_OF_JANUARY.until(Integer.MAX_VALUE))
.static HistoricDate
of(HistoricEra era, int yearOfEra, int month, int dom, YearDefinition yearDefinition, NewYearStrategy newYearStrategy)
Constructs a new tuple of given historic chronological components.toString()
-
Method Details
-
of
Equivalent to
HistoricDate.of(era, yearOfEra, month, dom, YearDefinition.DUAL_DATING, NewYearRule.BEGIN_OF_JANUARY.until(Integer.MAX_VALUE))
.- Parameters:
era
- historic erayearOfEra
- year of related era (1 <= yearOfEra
) starting on January the firstmonth
- historic month (1-12)dom
- historic day of month (1-31)- Returns:
- new historic date (not yet validated)
- Throws:
IllegalArgumentException
- if any argument is out of required maximum range- Since:
- 3.0
- See Also:
ChronoHistory.isValid(HistoricDate)
-
of
public static HistoricDate of(HistoricEra era, int yearOfEra, int month, int dom, YearDefinition yearDefinition, NewYearStrategy newYearStrategy)Constructs a new tuple of given historic chronological components.
Note: A detailed validation is not done. Such a validation is the responsibility of any
ChronoHistory
, however.- Parameters:
era
- historic erayearOfEra
- positive year of era which will be interpreted according to given year definitionmonth
- historic month (1-12)dom
- historic day of month (1-31)yearDefinition
- defines a strategy how to interprete year of eranewYearStrategy
- strategy how to determine New Year- Returns:
- new historic date (not yet validated)
- Throws:
IllegalArgumentException
- if any argument is out of required maximum range or inconsistent- Since:
- 3.18/4.14
- See Also:
ChronoHistory.isValid(HistoricDate)
-
getEra
Yields the historic era.
- Returns:
- HistoricEra
- Since:
- 3.0
-
getYearOfEra
public int getYearOfEra()Yields the year of the historic era starting on January the first.
- Returns:
- year of era
- Since:
- 3.0
- See Also:
getYearOfEra(NewYearStrategy)
,NewYearRule.BEGIN_OF_JANUARY
-
getYearOfEra
Yields the displayed historic year whose begin is determined by given new-year-strategy.
- Parameters:
newYearStrategy
- strategy how to determine New Year- Returns:
- displayed historic year (never negative)
- Since:
- 3.14/4.11
- See Also:
getYearOfEra()
,NewYearRule
-
getMonth
public int getMonth()Yields the historic month.
- Returns:
- month (1-12)
- Since:
- 3.0
-
getDayOfMonth
public int getDayOfMonth()Yields the historic day of month.
- Returns:
- day of month (1-31)
- Since:
- 3.0
-
compareTo
- Specified by:
compareTo
in interfaceComparable<HistoricDate>
-
equals
-
hashCode
public int hashCode() -
toString
-