@Immutable
public class CalendarPeriod
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CalendarPeriod.Field
Fields that can be set on a CalendarPeriod, used to prevent exposure of underlying implementation.
|
Modifier and Type | Field and Description |
---|---|
static CalendarPeriod |
Hour |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static CalendarPeriod.Field |
fromUnitString(java.lang.String udunit)
Convert a period string into a CalendarPeriod.Field.
|
double |
getConvertFactor(CalendarPeriod from)
Get the conversion factor of the other CalendarPeriod to this one
|
CalendarPeriod.Field |
getField() |
int |
getOffset(CalendarDate start,
CalendarDate end) |
int |
getValue() |
int |
hashCode() |
CalendarPeriod |
multiply(int value)
Multiply the period by an integer
|
static CalendarPeriod |
of(int value,
CalendarPeriod.Field field) |
static CalendarPeriod |
of(java.lang.String udunit)
Convert a udunit period string into a CalendarPeriod
|
static CalendarPeriod |
of(TimeDuration td) |
int |
subtract(CalendarDate start,
CalendarDate end)
Subtract two dates, return difference in units of this period.
|
java.lang.String |
toString() |
public static final CalendarPeriod Hour
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public static CalendarPeriod.Field fromUnitString(java.lang.String udunit)
udunit
- period stringjava.lang.IllegalArgumentException
- if not valid formatpublic double getConvertFactor(CalendarPeriod from)
from
- convert from thispublic CalendarPeriod.Field getField()
public int getOffset(CalendarDate start, CalendarDate end)
public int getValue()
public int hashCode()
hashCode
in class java.lang.Object
public CalendarPeriod multiply(int value)
value
- multiply by thispublic static CalendarPeriod of(int value, CalendarPeriod.Field field)
public static CalendarPeriod of(java.lang.String udunit)
udunit
- period string : "[val] unit"public static CalendarPeriod of(TimeDuration td)
public int subtract(CalendarDate start, CalendarDate end)
start
- start dateend
- end datepublic java.lang.String toString()
toString
in class java.lang.Object