@Immutable public class CalendarPeriod extends 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(Object o) |
static CalendarPeriod.Field |
fromUnitString(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(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.
|
String |
toString() |
public static final CalendarPeriod Hour
public static CalendarPeriod.Field fromUnitString(String udunit)
udunit
- period stringIllegalArgumentException
- 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 CalendarPeriod multiply(int value)
value
- multiply by thispublic static CalendarPeriod of(int value, CalendarPeriod.Field field)
public static CalendarPeriod of(String udunit)
udunit
- period string : "[val] unit"public static CalendarPeriod of(TimeDuration td)
public int subtract(CalendarDate start, CalendarDate end)
start
- start dateend
- end date