|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jfree.data.time.RegularTimePeriod
org.jfree.data.time.Quarter
Defines a quarter (in a given year). The range supported is Q1 1900 to Q4 9999.
This class is immutable, which is a requirement for all RegularTimePeriod subclasses.
| Field Summary | |
static int[] |
FIRST_MONTH_IN_QUARTER
The first month in each quarter. |
static int |
FIRST_QUARTER
Constant for quarter 1. |
static int[] |
LAST_MONTH_IN_QUARTER
The last month in each quarter. |
static int |
LAST_QUARTER
Constant for quarter 4. |
| 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 | |
Quarter()
Constructs a new Quarter, based on the current system date/time. |
|
Quarter(java.util.Date time)
Constructs a new Quarter, based on a date/time and the default time zone. |
|
Quarter(java.util.Date time,
java.util.TimeZone zone)
Constructs a Quarter, based on a date/time and time zone. |
|
Quarter(int quarter,
int year)
Constructs a new quarter. |
|
Quarter(int quarter,
Year year)
Constructs a new quarter. |
|
| Method Summary | |
int |
compareTo(java.lang.Object o1)
Returns an integer indicating the order of this Quarter object relative to the specified object: negative == before, zero == same, positive == after. |
boolean |
equals(java.lang.Object obj)
Tests the equality of this Quarter object to an arbitrary object. |
long |
getFirstMillisecond(java.util.Calendar calendar)
Returns the first millisecond in the Quarter, evaluated using the supplied calendar (which determines the time zone). |
long |
getLastMillisecond(java.util.Calendar calendar)
Returns the last millisecond of the Quarter, evaluated using the supplied calendar (which determines the time zone). |
int |
getQuarter()
Returns the quarter. |
long |
getSerialIndex()
Returns a serial index number for the quarter. |
Year |
getYear()
Returns the year. |
int |
hashCode()
Returns a hash code for this object instance. |
RegularTimePeriod |
next()
Returns the quarter following this one. |
static Quarter |
parseQuarter(java.lang.String s)
Parses the string argument as a quarter. |
RegularTimePeriod |
previous()
Returns the quarter preceding this one. |
java.lang.String |
toString()
Returns a string representing the quarter (e.g. |
| Methods inherited from class org.jfree.data.time.RegularTimePeriod |
getEnd, getFirstMillisecond, getFirstMillisecond, getLastMillisecond, getLastMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMiddleMillisecond, getStart |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int FIRST_QUARTER
public static final int LAST_QUARTER
public static final int[] FIRST_MONTH_IN_QUARTER
public static final int[] LAST_MONTH_IN_QUARTER
| Constructor Detail |
public Quarter()
public Quarter(int quarter,
int year)
year - the year (1900 to 9999).quarter - the quarter (1 to 4).
public Quarter(int quarter,
Year year)
quarter - the quarter (1 to 4).year - the year (1900 to 9999).public Quarter(java.util.Date time)
time - the date/time.
public Quarter(java.util.Date time,
java.util.TimeZone zone)
time - the date/time.zone - the zone.| Method Detail |
public int getQuarter()
public Year getYear()
public RegularTimePeriod previous()
previous in class RegularTimePeriodpublic RegularTimePeriod next()
next in class RegularTimePeriodpublic long getSerialIndex()
getSerialIndex in class RegularTimePeriodpublic boolean equals(java.lang.Object obj)
obj - the object.
true if quarter and year of this and the object are the same.public int hashCode()
The approach described by Joshua Bloch in "Effective Java" has been used here:
http://developer.java.sun.com/developer/Books/effectivejava/Chapter3.pdf
public int compareTo(java.lang.Object o1)
compareTo in interface java.lang.Comparableo1 - the object to compare
public java.lang.String toString()
toString in class RegularTimePeriodpublic long getFirstMillisecond(java.util.Calendar calendar)
getFirstMillisecond in class RegularTimePeriodcalendar - the calendar.
public long getLastMillisecond(java.util.Calendar calendar)
getLastMillisecond in class RegularTimePeriodcalendar - the calendar.
public static Quarter parseQuarter(java.lang.String s)
This method should accept the following formats: "YYYY-QN" and "QN-YYYY", where the "-" can be a space, a forward-slash (/), comma or a dash (-).
s - A string representing the quarter.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||