| java.lang.Object org.jfree.data.time.RegularTimePeriod
All known Subclasses: org.jfree.data.time.Year, org.jfree.data.time.Millisecond, org.jfree.data.time.FixedMillisecond, org.jfree.data.time.Week, org.jfree.data.time.Month, org.jfree.data.time.Quarter, org.jfree.data.time.Minute, org.jfree.data.time.Day, org.jfree.data.time.Hour, org.jfree.data.time.Second,
RegularTimePeriod | abstract public class RegularTimePeriod implements TimePeriod,Comparable,MonthConstants(Code) | | 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.
This class is immutable, and all subclasses should be immutable also.
|
Method Summary | |
public static RegularTimePeriod | createInstance(Class c, Date millisecond, TimeZone zone) Creates a time period that includes the specified millisecond, assuming
the given time zone.
Parameters: c - the time period class. Parameters: millisecond - the time. Parameters: zone - the time zone. | public static Class | downsize(Class c) Returns a subclass of
RegularTimePeriod that is smaller than
the specified class.
Parameters: c - a subclass of RegularTimePeriod. | public Date | getEnd() Returns the date/time that marks the end of the time period. | abstract public long | getFirstMillisecond() Returns the first millisecond of the time period. | public long | getFirstMillisecond(TimeZone zone) Returns the first millisecond of the time period, evaluated within a
specific time zone.
Parameters: zone - the time zone (null not permitted). | abstract public long | getFirstMillisecond(Calendar calendar) Returns the first millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar (null not permitted). | abstract public long | getLastMillisecond() Returns the last millisecond of the time period. | public long | getLastMillisecond(TimeZone zone) Returns the last millisecond of the time period, evaluated within a
specific time zone.
Parameters: zone - the time zone (null not permitted). | abstract public long | getLastMillisecond(Calendar calendar) Returns the last millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar (null not permitted). | public long | getMiddleMillisecond() Returns the millisecond closest to the middle of the time period. | public long | getMiddleMillisecond(TimeZone zone) Returns the millisecond closest to the middle of the time period,
evaluated within a specific time zone.
Parameters: zone - the time zone (null not permitted). | public long | getMiddleMillisecond(Calendar calendar) Returns the millisecond closest to the middle of the time period,
evaluated using the supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar. | abstract public long | getSerialIndex() Returns a serial index number for the time unit. | public Date | getStart() Returns the date/time that marks the start of the time period. | abstract public RegularTimePeriod | next() Returns the time period following this one, or null if some
limit has been reached. | abstract public 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 public RegularTimePeriod | previous() Returns the time period preceding this one, or null if some
lower limit has been reached. | public String | toString() Returns a string representation of the time period. |
DEFAULT_TIME_ZONE | final public static TimeZone DEFAULT_TIME_ZONE(Code) | | The default time zone.
|
WORKING_CALENDAR | final public static Calendar WORKING_CALENDAR(Code) | | A working calendar (recycle to avoid unnecessary object creation).
|
createInstance | public static RegularTimePeriod createInstance(Class c, Date millisecond, TimeZone zone)(Code) | | Creates a time period that includes the specified millisecond, assuming
the given time zone.
Parameters: c - the time period class. Parameters: millisecond - the time. Parameters: zone - the time zone. The time period. |
getFirstMillisecond | abstract public long getFirstMillisecond()(Code) | | Returns the first millisecond of the time period. This will be
determined relative to the time zone specified in the constructor, or
in the calendar instance passed in the most recent call to the
RegularTimePeriod.peg(Calendar) method.
The first millisecond of the time period. See Also: RegularTimePeriod.getLastMillisecond() |
getFirstMillisecond | abstract public long getFirstMillisecond(Calendar calendar)(Code) | | Returns the first millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar (null not permitted). The first millisecond of the time period. throws: NullPointerException - if calendar,/code> is null. See Also: RegularTimePeriod.getLastMillisecond(Calendar) |
getLastMillisecond | abstract public long getLastMillisecond()(Code) | | Returns the last millisecond of the time period. This will be
determined relative to the time zone specified in the constructor, or
in the calendar instance passed in the most recent call to the
RegularTimePeriod.peg(Calendar) method.
The last millisecond of the time period. See Also: RegularTimePeriod.getFirstMillisecond() |
getLastMillisecond | abstract public long getLastMillisecond(Calendar calendar)(Code) | | Returns the last millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar (null not permitted). The last millisecond of the time period. See Also: RegularTimePeriod.getFirstMillisecond(Calendar) |
getMiddleMillisecond | public long getMiddleMillisecond()(Code) | | Returns the millisecond closest to the middle of the time period.
The middle millisecond. |
getMiddleMillisecond | public long getMiddleMillisecond(Calendar calendar)(Code) | | Returns the millisecond closest to the middle of the time period,
evaluated using the supplied calendar (which incorporates a timezone).
Parameters: calendar - the calendar. The middle millisecond. |
getSerialIndex | abstract public long getSerialIndex()(Code) | | Returns a serial index number for the time unit.
The serial index number. |
next | abstract public RegularTimePeriod next()(Code) | | Returns the time period following this one, or null if some
limit has been reached.
The next time period (possibly null ). |
peg | abstract public void peg(Calendar calendar)(Code) | | Recalculates the start date/time and end date/time for this time period
relative to the supplied calendar (which incorporates a time zone).
Parameters: calendar - the calendar (null not permitted). since: 1.0.3 |
previous | abstract public RegularTimePeriod previous()(Code) | | Returns the time period preceding this one, or null if some
lower limit has been reached.
The previous time period (possibly null ). |
toString | public String toString()(Code) | | Returns a string representation of the time period.
The string. |
|
|