public abstract class RegularTimePeriod extends Object implements TimePeriod, Comparable, MonthConstants
This class is immutable, and all subclasses should be immutable also.
| Constructor and Description |
|---|
RegularTimePeriod() |
| Modifier and Type | Method and Description |
|---|---|
static RegularTimePeriod |
createInstance(Class c,
Date millisecond,
TimeZone zone,
Locale locale)
Creates a time period that includes the specified millisecond, assuming
the given time zone.
|
static Class |
downsize(Class c)
Returns a subclass of
RegularTimePeriod that is smaller than
the specified class. |
Date |
getEnd()
Returns the date/time that marks the end of the time period.
|
abstract long |
getFirstMillisecond()
Returns the first millisecond of the time period.
|
abstract long |
getFirstMillisecond(Calendar calendar)
Returns the first millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
|
abstract long |
getLastMillisecond()
Returns the last millisecond of the time period.
|
abstract long |
getLastMillisecond(Calendar calendar)
Returns the last millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
|
long |
getMiddleMillisecond()
Returns the millisecond closest to the middle of the time period.
|
long |
getMiddleMillisecond(Calendar calendar)
Returns the millisecond closest to the middle of the time period,
evaluated using the supplied calendar (which incorporates a timezone).
|
long |
getMillisecond(TimePeriodAnchor anchor,
Calendar calendar)
Returns the millisecond (relative to the epoch) corresponding to the
specified
anchor using the supplied calendar
(which incorporates a time zone). |
abstract long |
getSerialIndex()
Returns a serial index number for the time unit.
|
Date |
getStart()
Returns the date/time that marks the start of the time period.
|
abstract RegularTimePeriod |
next()
Returns the time period following this one, or
null if some
limit has been reached. |
abstract void |
peg(Calendar calendar)
Recalculates the start date/time and end date/time for this time period
relative to the supplied calendar (which incorporates a time zone).
|
abstract RegularTimePeriod |
previous()
Returns the time period preceding this one, or
null if some
lower limit has been reached. |
String |
toString()
Returns a string representation of the time period.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompareTopublic static RegularTimePeriod createInstance(Class c, Date millisecond, TimeZone zone, Locale locale)
c - the time period class.millisecond - the time.zone - the time zone.locale - the locale.public static Class downsize(Class c)
RegularTimePeriod that is smaller than
the specified class.c - a subclass of RegularTimePeriod.public abstract RegularTimePeriod previous()
null if some
lower limit has been reached.null).public abstract RegularTimePeriod next()
null if some
limit has been reached.null).public abstract long getSerialIndex()
public abstract void peg(Calendar calendar)
calendar - the calendar (null not permitted).public Date getStart()
Date instance every time it is called.getStart in interface TimePeriodgetFirstMillisecond()public Date getEnd()
Date instance every time it is called.getEnd in interface TimePeriodgetLastMillisecond()public abstract long getFirstMillisecond()
peg(Calendar) method.getLastMillisecond()public abstract long getFirstMillisecond(Calendar calendar)
calendar - the calendar (null not permitted).NullPointerException - if calendar is null.getLastMillisecond(Calendar)public abstract long getLastMillisecond()
peg(Calendar) method.getFirstMillisecond()public abstract long getLastMillisecond(Calendar calendar)
calendar - the calendar (null not permitted).getFirstMillisecond(Calendar)public long getMiddleMillisecond()
public long getMiddleMillisecond(Calendar calendar)
calendar - the calendar.public long getMillisecond(TimePeriodAnchor anchor, Calendar calendar)
anchor using the supplied calendar
(which incorporates a time zone).anchor - the anchor (null not permitted).calendar - the calendar (null not permitted).Copyright © 2001–2017 JFree.org. All rights reserved.