org.jfree.data.time
public abstract class RegularTimePeriod extends java.lang.Object implements TimePeriod, java.lang.Comparable
This class is immutable, and all subclasses should be immutable also.
Modifier and Type | Field and Description |
---|---|
static java.util.TimeZone |
DEFAULT_TIME_ZONE
Deprecated.
As of 1.0.11, we discourage the use of this field - use
TimeZone.getDefault() instead. |
static java.util.Calendar |
WORKING_CALENDAR
Deprecated.
This was a bad idea, don't use it!
|
Constructor and Description |
---|
RegularTimePeriod() |
Modifier and Type | Method and Description |
---|---|
static RegularTimePeriod |
createInstance(java.lang.Class c,
java.util.Date millisecond,
java.util.TimeZone zone)
Creates a time period that includes the specified millisecond, assuming
the given time zone.
|
static java.lang.Class |
downsize(java.lang.Class c)
Returns a subclass of
RegularTimePeriod that is smaller than
the specified class. |
java.util.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(java.util.Calendar calendar)
Returns the first millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
|
long |
getFirstMillisecond(java.util.TimeZone zone)
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(Calendar) instead. |
abstract long |
getLastMillisecond()
Returns the last millisecond of the time period.
|
abstract long |
getLastMillisecond(java.util.Calendar calendar)
Returns the last millisecond of the time period, evaluated using the
supplied calendar (which incorporates a timezone).
|
long |
getLastMillisecond(java.util.TimeZone zone)
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(Calendar) instead. |
long |
getMiddleMillisecond()
Returns the millisecond closest to the middle of the time period.
|
long |
getMiddleMillisecond(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 |
getMiddleMillisecond(java.util.TimeZone zone)
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(Calendar) instead. |
abstract long |
getSerialIndex()
Returns a serial index number for the time unit.
|
java.util.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(java.util.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. |
java.lang.String |
toString()
Returns a string representation of the time period.
|
public static final java.util.TimeZone DEFAULT_TIME_ZONE
TimeZone.getDefault()
instead.public static final java.util.Calendar WORKING_CALENDAR
public RegularTimePeriod()
public static RegularTimePeriod createInstance(java.lang.Class c, java.util.Date millisecond, java.util.TimeZone zone)
c
- the time period class.millisecond
- the time.zone
- the time zone.public static java.lang.Class downsize(java.lang.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(java.util.Calendar calendar)
calendar
- the calendar (null
not permitted).public java.util.Date getStart()
Date
instance every time it is called.getStart
in interface TimePeriod
getFirstMillisecond()
public java.util.Date getEnd()
Date
instance every time it is called.getEnd
in interface TimePeriod
getLastMillisecond()
public abstract long getFirstMillisecond()
peg(Calendar)
method.getLastMillisecond()
public long getFirstMillisecond(java.util.TimeZone zone)
getFirstMillisecond(Calendar)
instead.zone
- the time zone (null
not permitted).getLastMillisecond(TimeZone)
public abstract long getFirstMillisecond(java.util.Calendar calendar)
calendar
- the calendar (null
not permitted).java.lang.NullPointerException
- if calendar,/code> is
null.getLastMillisecond(Calendar)
public abstract long getLastMillisecond()
peg(Calendar)
method.getFirstMillisecond()
public long getLastMillisecond(java.util.TimeZone zone)
getLastMillisecond(Calendar)
instead.zone
- the time zone (null
not permitted).getFirstMillisecond(TimeZone)
public abstract long getLastMillisecond(java.util.Calendar calendar)
calendar
- the calendar (null
not permitted).getFirstMillisecond(Calendar)
public long getMiddleMillisecond()
public long getMiddleMillisecond(java.util.TimeZone zone)
getMiddleMillisecond(Calendar)
instead.zone
- the time zone (null
not permitted).public long getMiddleMillisecond(java.util.Calendar calendar)
calendar
- the calendar.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.