org.jfree.data.time
public abstract class RegularTimePeriod extends Object implements TimePeriod, Comparable, MonthConstants
This class is immutable, and all subclasses should be immutable also.
Field Summary | |
---|---|
static TimeZone | DEFAULT_TIME_ZONE
The default time zone. |
static Calendar | WORKING_CALENDAR
A working calendar (recycle to avoid unnecessary object creation).
|
Method Summary | |
---|---|
static RegularTimePeriod | createInstance(Class c, Date millisecond, TimeZone zone)
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. |
long | getFirstMillisecond(TimeZone zone)
Returns the first millisecond of the time period, evaluated within a
specific time zone.
|
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. |
long | getLastMillisecond(TimeZone zone)
Returns the last millisecond of the time period, evaluated within a
specific time zone.
|
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(TimeZone zone)
Returns the millisecond closest to the middle of the time period,
evaluated within a specific time zone.
|
long | getMiddleMillisecond(Calendar calendar)
Returns the millisecond closest to the middle of the time period,
evaluated using the supplied calendar (which incorporates a timezone).
|
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.
|
Deprecated: This was a bad idea, don't use it!
A working calendar (recycle to avoid unnecessary object creation).Parameters: c the time period class. millisecond the time. zone the time zone.
Returns: The time period.
Parameters: c a subclass of RegularTimePeriod.
Returns: A class.
Date
instance every time it is called.
Returns: The end date/time.
See Also: getLastMillisecond
Returns: The first millisecond of the time period.
See Also: getLastMillisecond
Deprecated: As of 1.0.3, you should avoid using this method (it creates a new Calendar instance every time it is called). You are advised to call getFirstMillisecond instead.
Returns the first millisecond of the time period, evaluated within a specific time zone.Parameters: zone the time zone (null
not permitted).
Returns: The first millisecond of the time period.
See Also: getLastMillisecond
Parameters: calendar the calendar (null
not permitted).
Returns: The first millisecond of the time period.
Throws: NullPointerException if calendar,/code> is
null.
See Also: getLastMillisecond
Returns: The last millisecond of the time period.
See Also: getFirstMillisecond
Deprecated: As of 1.0.3, you should avoid using this method (it creates a new Calendar instance every time it is called). You are advised to call getLastMillisecond instead.
Returns the last millisecond of the time period, evaluated within a specific time zone.Parameters: zone the time zone (null
not permitted).
Returns: The last millisecond of the time period.
See Also: getFirstMillisecond
Parameters: calendar the calendar (null
not permitted).
Returns: The last millisecond of the time period.
See Also: getFirstMillisecond
Returns: The middle millisecond.
Deprecated: As of 1.0.3, you should avoid using this method (it creates a new Calendar instance every time it is called). You are advised to call getMiddleMillisecond instead.
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).
Returns: The middle millisecond.
Parameters: calendar the calendar.
Returns: The middle millisecond.
Returns: The serial index number.
Date
instance every time it is called.
Returns: The start date/time.
See Also: getFirstMillisecond
null
if some
limit has been reached.
Returns: The next time period (possibly null
).
Parameters: calendar the calendar (null
not permitted).
Since: 1.0.3
null
if some
lower limit has been reached.
Returns: The previous time period (possibly null
).
Returns: The string.