Package net.simplace.core.ui.jfreechart
Class TimePeriod
java.lang.Object
org.jfree.data.time.RegularTimePeriod
net.simplace.core.ui.jfreechart.TimePeriod
- All Implemented Interfaces:
Serializable
,Comparable
,org.jfree.data.time.TimePeriod
,org.jfree.date.MonthConstants
- Author:
- Andreas Enders
Represents a year in the range -9999 to 9999. This class is immutable,
which is a requirement for all
RegularTimePeriod
subclasses. - See Also:
-
Field Summary
Fields inherited from class org.jfree.data.time.RegularTimePeriod
DEFAULT_TIME_ZONE, WORKING_CALENDAR
Fields inherited from interface org.jfree.date.MonthConstants
APRIL, AUGUST, DECEMBER, FEBRUARY, JANUARY, JULY, JUNE, MARCH, MAY, NOVEMBER, OCTOBER, SEPTEMBER
-
Constructor Summary
ConstructorDescriptionCreates a newYear
, based on the current system date/time.TimePeriod
(Date start, Date end) Creates a time period representing a single year. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns an integer indicating the order of thisYear
object relative to the specified object: negative == before, zero == same, positive == after.boolean
Tests the equality of thisYear
object to an arbitrary object.long
Returns the first millisecond of the year.long
getFirstMillisecond
(Calendar calendar) Returns the first millisecond of the year, evaluated using the supplied calendar (which determines the time zone).long
Returns the last millisecond of the year.long
getLastMillisecond
(Calendar calendar) Returns the last millisecond of the year, evaluated using the supplied calendar (which determines the time zone).long
Returns a serial index number for the year.int
hashCode()
Returns a hash code for this object instance.org.jfree.data.time.RegularTimePeriod
next()
void
Recalculates the start date/time and end date/time for this time period relative to the supplied calendar (which incorporates a time zone).org.jfree.data.time.RegularTimePeriod
previous()
toString()
Returns a string representing the year..Methods inherited from class org.jfree.data.time.RegularTimePeriod
createInstance, downsize, getEnd, getFirstMillisecond, getLastMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMillisecond, getStart
-
Constructor Details
-
TimePeriod
public TimePeriod()Creates a newYear
, based on the current system date/time. -
TimePeriod
Creates a time period representing a single year.- Parameters:
start
-end
-year
- the year.
-
-
Method Details
-
getFirstMillisecond
public long getFirstMillisecond()Returns the first millisecond of the year. 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 thepeg(Calendar)
method.- Specified by:
getFirstMillisecond
in classorg.jfree.data.time.RegularTimePeriod
- Returns:
- The first millisecond of the year.
- See Also:
-
getLastMillisecond
public long getLastMillisecond()Returns the last millisecond of the year. 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 thepeg(Calendar)
method.- Specified by:
getLastMillisecond
in classorg.jfree.data.time.RegularTimePeriod
- Returns:
- The last millisecond of the year.
- See Also:
-
peg
Recalculates the start date/time and end date/time for this time period relative to the supplied calendar (which incorporates a time zone).- Specified by:
peg
in classorg.jfree.data.time.RegularTimePeriod
- Parameters:
calendar
- the calendar (null
not permitted).- Since:
- 1.0.3
-
getSerialIndex
public long getSerialIndex()Returns a serial index number for the year.The implementation simply returns the second of the start time number (e.g. 2002).
- Specified by:
getSerialIndex
in classorg.jfree.data.time.RegularTimePeriod
- Returns:
- The serial index number.
-
getFirstMillisecond
Returns the first millisecond of the year, evaluated using the supplied calendar (which determines the time zone).- Specified by:
getFirstMillisecond
in classorg.jfree.data.time.RegularTimePeriod
- Parameters:
calendar
- the calendar (null
not permitted).- Returns:
- The first millisecond of the year.
- Throws:
NullPointerException
- ifcalendar
isnull
.
-
getLastMillisecond
Returns the last millisecond of the year, evaluated using the supplied calendar (which determines the time zone).- Specified by:
getLastMillisecond
in classorg.jfree.data.time.RegularTimePeriod
- Parameters:
calendar
- the calendar (null
not permitted).- Returns:
- The last millisecond of the year.
- Throws:
NullPointerException
- ifcalendar
isnull
.
-
equals
Tests the equality of thisYear
object to an arbitrary object. Returnstrue
if the target is aYear
instance representing the same year as this object. In all other cases, returnsfalse
. -
hashCode
public int hashCode()Returns a hash code for this object instance. The approach described by Joshua Bloch in "Effective Java" has been used here:http://developer.java.sun.com/developer/Books/effectivejava /Chapter3.pdf
-
compareTo
Returns an integer indicating the order of thisYear
object relative to the specified object: negative == before, zero == same, positive == after.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o1
- the object to compare.- Returns:
- negative == before, zero == same, positive == after.
-
toString
Returns a string representing the year..- Overrides:
toString
in classorg.jfree.data.time.RegularTimePeriod
- Returns:
- A string representing the year.
-
previous
public org.jfree.data.time.RegularTimePeriod previous()- Specified by:
previous
in classorg.jfree.data.time.RegularTimePeriod
-
next
public org.jfree.data.time.RegularTimePeriod next()- Specified by:
next
in classorg.jfree.data.time.RegularTimePeriod
-