Enum Class EpochDays
- All Implemented Interfaces:
Serializable,Comparable<EpochDays>,java.lang.constant.Constable,Comparator<ChronoDisplay>,ChronoElement<Long>
Defines elements based on different epoch-related day numbers.
Some day number procedures really use decimal fractions in order to
represent wall time fractions in calendar dates (for example julian days).
This enum only supports pure date types of type Calendrical and
always uses the largest integer which is still smaller than or equal to
the decimal fraction in question (mathematically a
floor()-function.
Instances of this element class will be automatically registered in
any chronology which is compatible to Calendrical.
- Author:
- Meno Hochschild
- See Also:
Calendrical
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCount of days relative to the ISO-date [1601-01-01] as day 1.Count of days relative to the ISO-date [1900-01-01] as day 1.Count of julian days relative to the the julian calendar date [1st of January 4713 BC] at noon [12:00] as day zero.Count of days relative to gregorian cut-over date [1582-10-15] as day 1.Count of days relative to the ISO-date [1858-11-17] as day zero.Count of days relative to the ISO-date [0001-01-01] as day 1.Reference point is the first of January 1970 at midnight as day zero.Reference point is the introduction of UTC on date [1972-01-01] at midnight as day zero. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(ChronoDisplay o1, ChronoDisplay o2)Applies an element-orientated sorting of any chronological entities.Returns the default maximum of this element which is not dependent on the chronological context.Returns the default minimum of this element which is not dependent on the chronological context.charDefines the format symbol.getType()Yields the reified value type.booleanThis element is a date element.booleanQueries if setting of element values is performed in a lenient way.booleanThis element is no wall time element.longConverts given day number to a day number based on this epoch at reference time of midnight.static EpochDaysReturns the enum constant of this class with the specified name.static EpochDays[]values()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, valueOfMethods inherited from interface net.time4j.engine.ChronoElement
getDisplayName, nameMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Enum Constant Details
-
UTC
Reference point is the introduction of UTC on date [1972-01-01] at midnight as day zero.
-
UNIX
Reference point is the first of January 1970 at midnight as day zero.
Example:
import static net.time4j.Month.FEBRUARY; PlainDate date = PlainDate.of(1970, FEBRUARY, 4); System.out.println(date.get(EpochDays.UNIX)); // output: 34
Strictly spoken, the UNIX time is counted in seconds. This element counts in days based on the relation "1 day = 86400 seconds".
-
MODIFIED_JULIAN_DATE
Count of days relative to the ISO-date [1858-11-17] as day zero.
Used by astronomers for example.
-
EXCEL
Count of days relative to the ISO-date [1900-01-01] as day 1.
Used by MS-Excel in Windows operating systems.
-
ANSI
Count of days relative to the ISO-date [1601-01-01] as day 1.
Used by COBOL for example.
-
RATA_DIE
Count of days relative to the ISO-date [0001-01-01] as day 1.
Used by the autors Nachum Dershowitz and Edward M. Reingold in their standard work "CalendarDate Calculations".
-
JULIAN_DAY_NUMBER
Count of julian days relative to the the julian calendar date [1st of January 4713 BC] at noon [12:00] as day zero.
The julian epoch date corresponds to the proleptic ISO-date [-4713-11-24]. The ISO-day centered around noon will be taken into account whose associated julian day starts at noon.
-
LILIAN_DAY_NUMBER
Count of days relative to gregorian cut-over date [1582-10-15] as day 1.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
transform
Converts given day number to a day number based on this epoch at reference time of midnight.
- Parameters:
amount- count of days relative to given epoch at noonepoch- epoch reference- Returns:
- count of days relative to this epoch
- Throws:
IllegalArgumentException- if the first argument is out of range
-
getType
Description copied from interface:ChronoElementYields the reified value type.
- Specified by:
getTypein interfaceChronoElement<Long>- Returns:
- type of associated values
-
getSymbol
public char getSymbol()Defines the format symbol.
- Specified by:
getSymbolin interfaceChronoElement<Long>- Returns:
- "g" if MODIFIED_JULIAN_DATE else ASCII-0
- See Also:
FormattableElement
-
compare
Description copied from interface:ChronoElementApplies an element-orientated sorting of any chronological entities.
The value type V is usually a subtype of the interface
Comparableso that this method will usually be based on the expressiono1.get(this).compareTo(o2.get(this)). In other words, this method compares the element values of given chronological entities. It is even permitted to compare entities of different chronological types as long as the entities both support this element.It should be noted however that a element value comparison does often not induce any temporal (complete) order. Counter examples are the year of gregorian BC-era (reversed temporal order before Jesu birth) or the clock display of hours (12 is indeed the begin at midnight).
- Specified by:
comparein interfaceChronoElement<Long>- Specified by:
comparein interfaceComparator<ChronoDisplay>- Parameters:
o1- the first object to be comparedo2- the second object to be compared- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
-
getDefaultMinimum
Description copied from interface:ChronoElementReturns the default minimum of this element which is not dependent on the chronological context.
Note: This minimum does not necessarily define a minimum for all possible circumstances but only the default minimum under normal conditions such that the default minimum always exists and can be used as prototypical value. An example is the start of day which is usually midnight in ISO-8601 and can only deviate in specialized timezone context.
- Specified by:
getDefaultMinimumin interfaceChronoElement<Long>- Returns:
- default minimum value of element
- See Also:
ChronoElement.getDefaultMaximum()
-
getDefaultMaximum
Description copied from interface:ChronoElementReturns the default maximum of this element which is not dependent on the chronological context.
Note: This maximum does not necessarily define a maximum for all possible circumstances but only the default maximum under normal conditions. An example is the second of minute whose default maximum is
59while the largest maximum can be60in context of UTC-leapseconds.- Specified by:
getDefaultMaximumin interfaceChronoElement<Long>- Returns:
- default maximum value of element
- See Also:
ChronoElement.getDefaultMinimum()
-
isDateElement
public boolean isDateElement()This element is a date element.
- Specified by:
isDateElementin interfaceChronoElement<Long>- Returns:
true- See Also:
ChronoElement.isTimeElement()
-
isTimeElement
public boolean isTimeElement()This element is no wall time element.
- Specified by:
isTimeElementin interfaceChronoElement<Long>- Returns:
false- See Also:
ChronoElement.isDateElement()
-
isLenient
public boolean isLenient()Description copied from interface:ChronoElementQueries if setting of element values is performed in a lenient way.
- Specified by:
isLenientin interfaceChronoElement<Long>- Returns:
trueif lenient elsefalse(standard)- See Also:
ElementRule.withValue(T, V, boolean)
-