Package org.ojalgo.type
Enum CalendarDateUnit
- 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.ChronoUnit
myChronoUnit
private long
myDurationInMillis
private long
myDurationInNanos
private long
myHalf
private java.lang.String
myLabel
private java.util.concurrent.TimeUnit
myTimeUnit
-
Constructor Summary
Constructors Modifier Constructor Description private
CalendarDateUnit(java.time.temporal.ChronoUnit chronoUnit, long millis, java.lang.String label)
private
CalendarDateUnit(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)
long
adjustInto(long epochMilli)
Maps a range of instances in time to a single instance.java.time.temporal.Temporal
adjustInto(java.time.temporal.Temporal temporal)
CalendarDate
adjustInto(CalendarDate temporal)
long
between(java.time.temporal.Temporal temporal1Inclusive, java.time.temporal.Temporal temporal2Exclusive)
double
convert(double sourceDurationMeasure, CalendarDateUnit sourceDurationUnit)
long
convert(long sourceMeassure, CalendarDateUnit sourceUnit)
CalendarDateDuration
convert(CalendarDateDuration sourceDuration)
double
convert(CalendarDateUnit aSourceDurationUnit)
long
count(long aFromValue, long aToValue)
long
get(java.time.temporal.TemporalUnit unit)
java.util.Optional<java.time.temporal.ChronoUnit>
getChronoUnit()
java.time.Duration
getDuration()
java.lang.String
getLabel()
java.util.Optional<java.util.concurrent.TimeUnit>
getTimeUnit()
java.util.List<java.time.temporal.TemporalUnit>
getUnits()
boolean
isCalendarUnit()
boolean
isDateBased()
boolean
isDurationEstimated()
boolean
isTimeBased()
CalendarDateDuration
newDuration(double meassure)
long
toDurationInMillis()
The size/duration of a timeline resolution "unit".long
toDurationInNanos()
static CalendarDateUnit
valueOf(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:
addTo
in interfacejava.time.temporal.TemporalUnit
-
adjustInto
public CalendarDate adjustInto(CalendarDate temporal)
- Specified by:
adjustInto
in interfaceCalendarDate.Resolution
-
adjustInto
public long adjustInto(long epochMilli)
Description copied from interface:CalendarDate.Resolution
Maps a range of instances in time to a single instance.- Specified by:
adjustInto
in interfaceCalendarDate.Resolution
-
adjustInto
public java.time.temporal.Temporal adjustInto(java.time.temporal.Temporal temporal)
- Specified by:
adjustInto
in interfacejava.time.temporal.TemporalAdjuster
-
between
public long between(java.time.temporal.Temporal temporal1Inclusive, java.time.temporal.Temporal temporal2Exclusive)
- Specified by:
between
in 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:
getDuration
in 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:
isDateBased
in interfacejava.time.temporal.TemporalUnit
-
isDurationEstimated
public boolean isDurationEstimated()
- Specified by:
isDurationEstimated
in interfacejava.time.temporal.TemporalUnit
-
isTimeBased
public boolean isTimeBased()
- Specified by:
isTimeBased
in interfacejava.time.temporal.TemporalUnit
-
newDuration
public CalendarDateDuration newDuration(double meassure)
-
toDurationInMillis
public long toDurationInMillis()
Description copied from interface:CalendarDate.Resolution
The size/duration of a timeline resolution "unit".- Specified by:
toDurationInMillis
in interfaceCalendarDate.Resolution
-
toDurationInNanos
public long toDurationInNanos()
- Specified by:
toDurationInNanos
in interfaceCalendarDate.Resolution
-
-