|
||||||||||
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.Month
Represents a single month.
This class is immutable, which is a requirement for all
RegularTimePeriod
subclasses.
Field Summary |
Fields inherited from class org.jfree.data.time.RegularTimePeriod |
DEFAULT_TIME_ZONE, WORKING_CALENDAR |
Constructor Summary | |
Month()
Constructs a new Month, based on the current system time. |
|
Month(java.util.Date time)
Constructs a new month instance, based on a date/time and the default time zone. |
|
Month(java.util.Date time,
java.util.TimeZone zone)
Constructs a Month, based on a date/time and a time zone. |
|
Month(int month,
int year)
Constructs a new month instance. |
|
Month(int month,
Year year)
Constructs a new month instance. |
Method Summary | |
int |
compareTo(java.lang.Object o1)
Returns an integer indicating the order of this Month object relative to the specified object: negative == before, zero == same, positive == after. |
boolean |
equals(java.lang.Object obj)
Tests the equality of this Month object to an arbitrary object. |
long |
getFirstMillisecond(java.util.Calendar calendar)
Returns the first millisecond of the month, evaluated using the supplied calendar (which determines the time zone). |
long |
getLastMillisecond(java.util.Calendar calendar)
Returns the last millisecond of the month, evaluated using the supplied calendar (which determines the time zone). |
int |
getMonth()
Returns the month. |
long |
getSerialIndex()
Returns a serial index number for the month. |
Year |
getYear()
Returns the year in which the month falls. |
int |
getYearValue()
Returns the year in which the month falls. |
int |
hashCode()
Returns a hash code for this object instance. |
RegularTimePeriod |
next()
Returns the month following this one. |
static Month |
parseMonth(java.lang.String s)
Parses the string argument as a month. |
RegularTimePeriod |
previous()
Returns the month preceding this one. |
java.lang.String |
toString()
Returns a string representing the month (e.g. |
Methods inherited from class org.jfree.data.time.RegularTimePeriod |
createInstance, downsize, getEnd, getFirstMillisecond, getFirstMillisecond, getLastMillisecond, getLastMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMiddleMillisecond, getStart |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Month()
public Month(int month, int year)
month
- the month (in the range 1 to 12).year
- the year.public Month(int month, Year year)
month
- the month (in the range 1 to 12).year
- the year.public Month(java.util.Date time)
time
- the date/time.public Month(java.util.Date time, java.util.TimeZone zone)
time
- the date/time.zone
- the time zone.Method Detail |
public Year getYear()
public int getYearValue()
public int getMonth()
public RegularTimePeriod previous()
previous
in class RegularTimePeriod
public RegularTimePeriod next()
next
in class RegularTimePeriod
public long getSerialIndex()
getSerialIndex
in class RegularTimePeriod
public java.lang.String toString()
To do: look at internationalisation.
toString
in class RegularTimePeriod
public boolean equals(java.lang.Object obj)
obj
- the object.
true
if month and year of this and 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.Comparable
o1
- the object to compare.
public long getFirstMillisecond(java.util.Calendar calendar)
getFirstMillisecond
in class RegularTimePeriod
calendar
- the calendar.
public long getLastMillisecond(java.util.Calendar calendar)
getLastMillisecond
in class RegularTimePeriod
calendar
- the calendar.
public static Month parseMonth(java.lang.String s)
This method is required to accept the format "YYYY-MM". It will also accept "MM-YYYY". Anything else, at the moment, is a bonus.
s
- the string to parse.
null
if the string is not parseable, the month otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |