- java.lang.Object
-
- java.lang.Enum<CalendarDateUnit>
-
- org.ojalgo.type.CalendarDateUnit
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CalendarDateUnit>,java.time.temporal.TemporalAdjuster,java.time.temporal.TemporalUnit,Structure1D.IndexMapper<CalendarDate>,CalendarDate.Resolution
public enum CalendarDateUnit extends java.lang.Enum<CalendarDateUnit> implements java.time.temporal.TemporalUnit, CalendarDate.Resolution
Designed to complement CalendarDate. It is essentially equivalent to ChronoUnit, but with a slightly smaller set of members (and the additional QUARTER). It has been retrofitted to implement the TemporalUnit interface.
- See Also:
CalendarDate,CalendarDateDuration
-
-
Field Summary
Fields Modifier and Type Field Description private java.time.temporal.ChronoUnitmyChronoUnitprivate longmyDurationInMillisprivate longmyDurationInNanosprivate longmyHalfprivate java.lang.StringmyLabelprivate java.util.concurrent.TimeUnitmyTimeUnit
-
Constructor Summary
Constructors Modifier Constructor Description privateCalendarDateUnit(java.time.temporal.ChronoUnit chronoUnit, long millis, java.lang.String label)privateCalendarDateUnit(java.time.temporal.ChronoUnit chronoUnit, java.util.concurrent.TimeUnit timeUnit, java.lang.String label)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R extends java.time.temporal.Temporal>
RaddTo(R temporal, long amount)longadjustInto(long epochMilli)Maps a range of instances in time to a single instance.java.time.temporal.TemporaladjustInto(java.time.temporal.Temporal temporal)CalendarDateadjustInto(CalendarDate temporal)longbetween(java.time.temporal.Temporal temporal1Inclusive, java.time.temporal.Temporal temporal2Exclusive)doubleconvert(double sourceDurationMeasure, CalendarDateUnit sourceDurationUnit)longconvert(long sourceMeassure, CalendarDateUnit sourceUnit)CalendarDateDurationconvert(CalendarDateDuration sourceDuration)doubleconvert(CalendarDateUnit aSourceDurationUnit)longcount(long aFromValue, long aToValue)longget(java.time.temporal.TemporalUnit unit)java.util.Optional<java.time.temporal.ChronoUnit>getChronoUnit()java.time.DurationgetDuration()java.lang.StringgetLabel()java.util.Optional<java.util.concurrent.TimeUnit>getTimeUnit()java.util.List<java.time.temporal.TemporalUnit>getUnits()booleanisCalendarUnit()booleanisDateBased()booleanisDurationEstimated()booleanisTimeBased()CalendarDateDurationnewDuration(double meassure)longtoDurationInMillis()The size/duration of a timeline resolution "unit".longtoDurationInNanos()static CalendarDateUnitvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static CalendarDateUnit[]values()Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface org.ojalgo.type.CalendarDate.Resolution
addTo, toIndex, toKey
-
Methods inherited from interface org.ojalgo.structure.Structure1D.IndexMapper
next, previous
-
-
-
-
Enum Constant Detail
-
NANOS
public static final CalendarDateUnit NANOS
-
MICROS
public static final CalendarDateUnit MICROS
-
MILLIS
public static final CalendarDateUnit MILLIS
-
SECOND
public static final CalendarDateUnit SECOND
-
MINUTE
public static final CalendarDateUnit MINUTE
-
HOUR
public static final CalendarDateUnit HOUR
-
DAY
public static final CalendarDateUnit DAY
-
WEEK
public static final CalendarDateUnit WEEK
-
MONTH
public static final CalendarDateUnit MONTH
-
QUARTER
public static final CalendarDateUnit QUARTER
-
YEAR
public static final CalendarDateUnit YEAR
-
DECADE
public static final CalendarDateUnit DECADE
-
CENTURY
public static final CalendarDateUnit CENTURY
-
MILLENIUM
public static final CalendarDateUnit MILLENIUM
-
-
Field Detail
-
myChronoUnit
private final java.time.temporal.ChronoUnit myChronoUnit
-
myDurationInMillis
private final long myDurationInMillis
-
myDurationInNanos
private final long myDurationInNanos
-
myHalf
private final long myHalf
-
myLabel
private final java.lang.String myLabel
-
myTimeUnit
private final java.util.concurrent.TimeUnit myTimeUnit
-
-
Method Detail
-
values
public static CalendarDateUnit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CalendarDateUnit c : CalendarDateUnit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CalendarDateUnit valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
addTo
public <R extends java.time.temporal.Temporal> R addTo(R temporal, long amount)- Specified by:
addToin interfacejava.time.temporal.TemporalUnit
-
adjustInto
public CalendarDate adjustInto(CalendarDate temporal)
- Specified by:
adjustIntoin interfaceCalendarDate.Resolution
-
adjustInto
public long adjustInto(long epochMilli)
Description copied from interface:CalendarDate.ResolutionMaps a range of instances in time to a single instance.- Specified by:
adjustIntoin interfaceCalendarDate.Resolution
-
adjustInto
public java.time.temporal.Temporal adjustInto(java.time.temporal.Temporal temporal)
- Specified by:
adjustIntoin interfacejava.time.temporal.TemporalAdjuster
-
between
public long between(java.time.temporal.Temporal temporal1Inclusive, java.time.temporal.Temporal temporal2Exclusive)- Specified by:
betweenin interfacejava.time.temporal.TemporalUnit
-
convert
public CalendarDateDuration convert(CalendarDateDuration sourceDuration)
-
convert
public double convert(CalendarDateUnit aSourceDurationUnit)
-
convert
public double convert(double sourceDurationMeasure, CalendarDateUnit sourceDurationUnit)
-
convert
public long convert(long sourceMeassure, CalendarDateUnit sourceUnit)
-
count
public long count(long aFromValue, long aToValue)
-
get
public long get(java.time.temporal.TemporalUnit unit)
-
getChronoUnit
public java.util.Optional<java.time.temporal.ChronoUnit> getChronoUnit()
-
getDuration
public java.time.Duration getDuration()
- Specified by:
getDurationin interfacejava.time.temporal.TemporalUnit
-
getLabel
public java.lang.String getLabel()
-
getTimeUnit
public java.util.Optional<java.util.concurrent.TimeUnit> getTimeUnit()
-
getUnits
public java.util.List<java.time.temporal.TemporalUnit> getUnits()
-
isCalendarUnit
public boolean isCalendarUnit()
-
isDateBased
public boolean isDateBased()
- Specified by:
isDateBasedin interfacejava.time.temporal.TemporalUnit
-
isDurationEstimated
public boolean isDurationEstimated()
- Specified by:
isDurationEstimatedin interfacejava.time.temporal.TemporalUnit
-
isTimeBased
public boolean isTimeBased()
- Specified by:
isTimeBasedin interfacejava.time.temporal.TemporalUnit
-
newDuration
public CalendarDateDuration newDuration(double meassure)
-
toDurationInMillis
public long toDurationInMillis()
Description copied from interface:CalendarDate.ResolutionThe size/duration of a timeline resolution "unit".- Specified by:
toDurationInMillisin interfaceCalendarDate.Resolution
-
toDurationInNanos
public long toDurationInNanos()
- Specified by:
toDurationInNanosin interfaceCalendarDate.Resolution
-
-