|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.data.TimePeriod
An abstract class representing a unit of time.
Convenient methods are provided for calculating the next and previous time periods.
Conversion methods are defined that return the first and last milliseconds of the time period. The results from these methods are timezone-dependent.
Subclasses of TimePeriod are required to be immutable.
Field Summary | |
static java.util.TimeZone |
DEFAULT_TIME_ZONE
The default time zone. |
static java.util.Calendar |
WORKING_CALENDAR
A working calendar (recycle to avoid unnecessary object creation). |
Fields inherited from interface com.jrefinery.date.MonthConstants |
APRIL, AUGUST, DECEMBER, FEBRUARY, JANUARY, JULY, JUNE, MARCH, MAY, NOVEMBER, OCTOBER, SEPTEMBER |
Constructor Summary | |
TimePeriod()
|
Method Summary | |
long |
getEnd()
Returns the last millisecond of the time period, evaluated in the default time zone. |
abstract long |
getEnd(java.util.Calendar calendar)
Returns the last millisecond of the time period, evaluated using the supplied calendar (which incorporates a timezone). |
long |
getEnd(java.util.TimeZone zone)
Returns the last millisecond of the time period, evaluated within a specific time zone. |
long |
getMiddle()
Returns the millisecond closest to the middle of the time period, evaluated in the default time zone. |
long |
getMiddle(java.util.Calendar calendar)
Returns the millisecond closest to the middle of the time period, evaluated using the supplied calendar (which incorporates a timezone). |
long |
getMiddle(java.util.TimeZone zone)
Returns the millisecond closest to the middle of the time period, evaluated within a specific time zone. |
abstract long |
getSerialIndex()
Returns a serial index number for the time unit. |
long |
getStart()
Returns the first millisecond of the time period, evaluated in the default time zone. |
abstract long |
getStart(java.util.Calendar calendar)
Returns the first millisecond of the time period, evaluated using the supplied calendar (which incorporates a timezone). |
long |
getStart(java.util.TimeZone zone)
Returns the first millisecond of the time period, evaluated within a specific time zone. |
abstract TimePeriod |
next()
Returns the time period following this one, or null if some limit has been reached. |
abstract TimePeriod |
previous()
Returns the time period preceding this one, or null if some lower limit has been reached. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
Field Detail |
public static final java.util.TimeZone DEFAULT_TIME_ZONE
public static final java.util.Calendar WORKING_CALENDAR
Constructor Detail |
public TimePeriod()
Method Detail |
public abstract TimePeriod previous()
public abstract TimePeriod next()
public abstract long getSerialIndex()
public long getStart()
public long getStart(java.util.TimeZone zone)
zone
- the time zone.public abstract long getStart(java.util.Calendar calendar)
calendar
- the calendar.public long getEnd()
public long getEnd(java.util.TimeZone zone)
zone
- the time zone.public abstract long getEnd(java.util.Calendar calendar)
calendar
- the calendar.public long getMiddle()
public long getMiddle(java.util.TimeZone zone)
zone
- the time zone.public long getMiddle(java.util.Calendar calendar)
calendar
- the calendar.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |