Package org.ojalgo.type
Class CalendarDateDuration
- java.lang.Object
-
- org.ojalgo.type.CalendarDateDuration
-
- All Implemented Interfaces:
java.lang.Comparable<CalendarDateDuration>
,java.time.temporal.TemporalAdjuster
,java.time.temporal.TemporalAmount
,Structure1D.IndexMapper<CalendarDate>
,CalendarDate.Resolution
,ComparableNumber<CalendarDateDuration>
,NumberDefinition
public final class CalendarDateDuration extends java.lang.Object implements java.time.temporal.TemporalAmount, CalendarDate.Resolution, ComparableNumber<CalendarDateDuration>
Designed to complement CalendarDate. It is similar to Duration or Period, but supports a decimal/fractional measure. It has been retrofitted to implement the TemporalAmount interface.
- See Also:
CalendarDate
,CalendarDateUnit
-
-
Field Summary
Fields Modifier and Type Field Description double
measure
CalendarDateUnit
unit
-
Constructor Summary
Constructors Constructor Description CalendarDateDuration()
CalendarDateDuration(double aMeasure, CalendarDateUnit aUnit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addTo(long epochMilli)
Will increment the input epochMilli by the size/duration of this timeline resolution.java.time.temporal.Temporal
addTo(java.time.temporal.Temporal temporal)
java.time.temporal.Temporal
adjustInto(java.time.temporal.Temporal temporal)
int
compareTo(CalendarDateDuration reference)
CalendarDateDuration
convertTo(CalendarDateUnit newUnit)
double
doubleValue()
boolean
equals(java.lang.Object obj)
float
floatValue()
long
get(java.time.temporal.TemporalUnit unit)
java.util.List<java.time.temporal.TemporalUnit>
getUnits()
int
hashCode()
int
intValue()
long
longValue()
(package private) static CalendarDateDuration
of(long nanos)
java.time.temporal.Temporal
subtractFrom(java.time.temporal.Temporal temporal)
long
toDurationInMillis()
The size/duration of a timeline resolution "unit".long
toDurationInNanos()
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ojalgo.type.CalendarDate.Resolution
adjustInto, adjustInto, toIndex, toKey
-
Methods inherited from interface org.ojalgo.type.NumberDefinition
booleanValue, byteValue, shortValue
-
Methods inherited from interface org.ojalgo.structure.Structure1D.IndexMapper
next, previous
-
-
-
-
Field Detail
-
measure
public final double measure
-
unit
public final CalendarDateUnit unit
-
-
Constructor Detail
-
CalendarDateDuration
public CalendarDateDuration(double aMeasure, CalendarDateUnit aUnit)
-
CalendarDateDuration
CalendarDateDuration()
-
-
Method Detail
-
of
static CalendarDateDuration of(long nanos)
-
addTo
public long addTo(long epochMilli)
Description copied from interface:CalendarDate.Resolution
Will increment the input epochMilli by the size/duration of this timeline resolution.- Specified by:
addTo
in interfaceCalendarDate.Resolution
-
addTo
public java.time.temporal.Temporal addTo(java.time.temporal.Temporal temporal)
- Specified by:
addTo
in interfacejava.time.temporal.TemporalAmount
-
adjustInto
public java.time.temporal.Temporal adjustInto(java.time.temporal.Temporal temporal)
- Specified by:
adjustInto
in interfacejava.time.temporal.TemporalAdjuster
-
compareTo
public int compareTo(CalendarDateDuration reference)
- Specified by:
compareTo
in interfacejava.lang.Comparable<CalendarDateDuration>
-
convertTo
public CalendarDateDuration convertTo(CalendarDateUnit newUnit)
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in interfaceNumberDefinition
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
floatValue
public float floatValue()
- Specified by:
floatValue
in interfaceNumberDefinition
-
get
public long get(java.time.temporal.TemporalUnit unit)
- Specified by:
get
in interfacejava.time.temporal.TemporalAmount
-
getUnits
public java.util.List<java.time.temporal.TemporalUnit> getUnits()
- Specified by:
getUnits
in interfacejava.time.temporal.TemporalAmount
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
intValue
public int intValue()
- Specified by:
intValue
in interfaceNumberDefinition
-
longValue
public long longValue()
- Specified by:
longValue
in interfaceNumberDefinition
-
subtractFrom
public java.time.temporal.Temporal subtractFrom(java.time.temporal.Temporal temporal)
- Specified by:
subtractFrom
in interfacejava.time.temporal.TemporalAmount
-
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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-