@Immutable
public class CalendarPeriod
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CalendarPeriod.Field |
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() |
double |
getValueInMillisecs()
Deprecated.
dont use because these are fixed length and thus approximate.
|
int |
hashCode() |
static void |
main(java.lang.String[] args) |
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
|
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 static CalendarPeriod.Field fromUnitString(java.lang.String udunit)
udunit
- period stringjava.lang.IllegalArgumentException
- if not valid formatpublic static CalendarPeriod of(int value, CalendarPeriod.Field field)
public static CalendarPeriod of(java.lang.String udunit)
udunit
- period string : "[val] unit"public CalendarPeriod multiply(int value)
value
- multiply by thispublic int getValue()
public CalendarPeriod.Field getField()
public int subtract(CalendarDate start, CalendarDate end)
start
- start dateend
- end datepublic double getConvertFactor(CalendarPeriod from)
from
- convert from thispublic double getValueInMillisecs()
public int getOffset(CalendarDate start, CalendarDate end)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static void main(java.lang.String[] args)