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
RegularTimePeriodsubclasses. - See Also:
-
Field Summary
Fields inherited from class org.jfree.data.time.RegularTimePeriod
DEFAULT_TIME_ZONE, WORKING_CALENDARFields inherited from interface org.jfree.date.MonthConstants
APRIL, AUGUST, DECEMBER, FEBRUARY, JANUARY, JULY, JUNE, MARCH, MAY, NOVEMBER, OCTOBER, SEPTEMBER -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionintReturns an integer indicating the order of thisYearobject relative to the specified object: negative == before, zero == same, positive == after.booleanTests the equality of thisYearobject to an arbitrary object.longReturns the first millisecond of the year.longgetFirstMillisecond(Calendar calendar) Returns the first millisecond of the year, evaluated using the supplied calendar (which determines the time zone).longReturns the last millisecond of the year.longgetLastMillisecond(Calendar calendar) Returns the last millisecond of the year, evaluated using the supplied calendar (which determines the time zone).longReturns a serial index number for the year.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 (which incorporates a time zone).org.jfree.data.time.RegularTimePeriodprevious()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:
getFirstMillisecondin 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:
getLastMillisecondin 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:
pegin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (nullnot 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:
getSerialIndexin 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:
getFirstMillisecondin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (nullnot permitted).- Returns:
- The first millisecond of the year.
- Throws:
NullPointerException- ifcalendarisnull.
-
getLastMillisecond
Returns the last millisecond of the year, evaluated using the supplied calendar (which determines the time zone).- Specified by:
getLastMillisecondin classorg.jfree.data.time.RegularTimePeriod- Parameters:
calendar- the calendar (nullnot permitted).- Returns:
- The last millisecond of the year.
- Throws:
NullPointerException- ifcalendarisnull.
-
equals
Tests the equality of thisYearobject to an arbitrary object. Returnstrueif the target is aYearinstance 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 thisYearobject relative to the specified object: negative == before, zero == same, positive == after.- Specified by:
compareToin interfaceComparable- Parameters:
o1- the object to compare.- Returns:
- negative == before, zero == same, positive == after.
-
toString
Returns a string representing the year..- Overrides:
toStringin classorg.jfree.data.time.RegularTimePeriod- Returns:
- A string representing the year.
-
previous
public org.jfree.data.time.RegularTimePeriod previous()- Specified by:
previousin classorg.jfree.data.time.RegularTimePeriod
-
next
public org.jfree.data.time.RegularTimePeriod next()- Specified by:
nextin classorg.jfree.data.time.RegularTimePeriod
-