|
Header
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jfree.data.time.RegularTimePeriod org.jfree.data.time.Quarter
public class 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 instance, based on a date/time and the default time zone. |
|
Quarter(java.util.Date time,
java.util.TimeZone zone)
Deprecated. Since 1.0.12, use Quarter(Date, TimeZone, Locale)
instead. |
|
Quarter(java.util.Date time,
java.util.TimeZone zone,
java.util.Locale locale)
Creates a new Quarter instance, using the specified
zone and locale. |
|
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()
Returns the first millisecond of the quarter. |
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()
Returns the last millisecond of the quarter. |
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 |
getYearValue()
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. |
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). |
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 |
---|
createInstance, downsize, getEnd, getFirstMillisecond, 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 (null
not permitted).Quarter(Date, TimeZone)
public Quarter(java.util.Date time, java.util.TimeZone zone)
Quarter(Date, TimeZone, Locale)
instead.
time
- the date/time.zone
- the zone (null
not permitted).public Quarter(java.util.Date time, java.util.TimeZone zone, java.util.Locale locale)
Quarter
instance, using the specified
zone and locale.
time
- the current time.zone
- the time zone.locale
- the locale.Method Detail |
---|
public int getQuarter()
public Year getYear()
public int getYearValue()
public long getFirstMillisecond()
peg(Calendar)
method.
getFirstMillisecond
in class RegularTimePeriod
getLastMillisecond()
public long getLastMillisecond()
peg(Calendar)
method.
getLastMillisecond
in class RegularTimePeriod
getFirstMillisecond()
public void peg(java.util.Calendar calendar)
peg
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).public RegularTimePeriod previous()
previous
in class RegularTimePeriod
null
if this is
Q1 1900).public RegularTimePeriod next()
next
in class RegularTimePeriod
public long getSerialIndex()
getSerialIndex
in class RegularTimePeriod
public boolean equals(java.lang.Object obj)
true
if the target is a Quarter instance
representing the same quarter as this object. In all other cases,
returns false
.
equals
in class java.lang.Object
obj
- the object (null
permitted).
true
if quarter and year of this and the object are
the same.public int hashCode()
http://developer.java.sun.com/developer/Books/effectivejava
/Chapter3.pdf
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object o1)
compareTo
in interface java.lang.Comparable
o1
- the object to compare
public java.lang.String toString()
toString
in class RegularTimePeriod
public long getFirstMillisecond(java.util.Calendar calendar)
getFirstMillisecond
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).
java.lang.NullPointerException
- if calendar
is
null
.RegularTimePeriod.getLastMillisecond(Calendar)
public long getLastMillisecond(java.util.Calendar calendar)
getLastMillisecond
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).
java.lang.NullPointerException
- if calendar
is
null
.RegularTimePeriod.getFirstMillisecond(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.
|
Footer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |