Class TimePeriod
java.lang.Object
org.jfree.data.time.RegularTimePeriod
net.simplace.ui.jfreechart.TimePeriod
- All Implemented Interfaces:
Serializable, Comparable, org.jfree.chart.date.MonthConstants, org.jfree.data.time.TimePeriod
Represents an arbitrary time period between two dates (adapted from the JFreeChart class
Year).
This class is immutable, which is a requirement for all RegularTimePeriod subclasses.- Author:
- Andreas Enders
- See Also:
-
Field Summary
Fields inherited from interface org.jfree.chart.date.MonthConstants
APRIL, AUGUST, DECEMBER, FEBRUARY, JANUARY, JULY, JUNE, MARCH, MAY, NOVEMBER, OCTOBER, SEPTEMBER -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty period at the current system date/time.TimePeriod(Date start, Date end) Creates a time period between two dates. -
Method Summary
Modifier and TypeMethodDescriptionintReturns an integer indicating the order of this period relative to the specified object: time periods are ordered by their first, then by their last millisecond.booleanTests the equality of this period to an arbitrary object.longReturns the first millisecond of the period.longgetFirstMillisecond(Calendar calendar) Returns the first millisecond of the period (independent of the calendar).longReturns the last millisecond of the period.longgetLastMillisecond(Calendar calendar) Returns the last millisecond of the period (independent of the calendar).longReturns a serial index number for the period.inthashCode()Returns a hash code for this object instance.org.jfree.data.time.RegularTimePeriodnext()voidRecalculates the start date/time and end date/time for this time period relative to the supplied calendar; the period is independent of the time zone, so nothing changes.org.jfree.data.time.RegularTimePeriodprevious()Returns the period of the same length ending at the start of this period.toString()Returns a string representing the period.Methods inherited from class org.jfree.data.time.RegularTimePeriod
createInstance, downsize, getCalendarInstance, getEnd, getMiddleMillisecond, getMiddleMillisecond, getMillisecond, getStart, setCalendarInstancePrototype, setThreadLocalCalendarInstance
-
Constructor Details
-
TimePeriod
public TimePeriod()Creates an empty period at the current system date/time. -
TimePeriod
-
-
Method Details
-
getFirstMillisecond
public long getFirstMillisecond()Returns the first millisecond of the period.- Specified by:
getFirstMillisecondin classorg.jfree.data.time.RegularTimePeriod- Returns:
- The first millisecond of the period.
- See Also:
-
getLastMillisecond
public long getLastMillisecond()Returns the last millisecond of the period.- Specified by:
getLastMillisecondin classorg.jfree.data.time.RegularTimePeriod- Returns:
- The last millisecond of the period.
- See Also:
-
peg
Recalculates the start date/time and end date/time for this time period relative to the supplied calendar; the period is independent of the time zone, so nothing changes.- Specified by:
pegin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (not used).
-
getSerialIndex
public long getSerialIndex()Returns a serial index number for the period.The implementation simply returns the start time in seconds.
- Specified by:
getSerialIndexin classorg.jfree.data.time.RegularTimePeriod- Returns:
- The serial index number.
-
getFirstMillisecond
Returns the first millisecond of the period (independent of the calendar).- Specified by:
getFirstMillisecondin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (not used).- Returns:
- The first millisecond of the period.
-
getLastMillisecond
Returns the last millisecond of the period (independent of the calendar).- Specified by:
getLastMillisecondin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (not used).- Returns:
- The last millisecond of the period.
-
equals
-
hashCode
-
compareTo
Returns an integer indicating the order of this period relative to the specified object: time periods are ordered by their first, then by their last millisecond.- Specified by:
compareToin interfaceComparable- Parameters:
o1- the object to compare.- Returns:
- negative, zero or positive if this period is before, equal to or after the given period; 1 (after) for objects that are no time periods
-
toString
Returns a string representing the period.- Overrides:
toStringin classorg.jfree.data.time.RegularTimePeriod- Returns:
- start and end as
MM-yyyy - MM-yyyy.
-
previous
public org.jfree.data.time.RegularTimePeriod previous()Returns the period of the same length ending at the start of this period.- Specified by:
previousin classorg.jfree.data.time.RegularTimePeriod- Returns:
- the previous period
-
next
public org.jfree.data.time.RegularTimePeriod next()- Specified by:
nextin classorg.jfree.data.time.RegularTimePeriod- Returns:
- the period of the same length starting at the end of this period
-