org.jfree.data.time
Class Month
- Comparable, MonthConstants, Serializable, TimePeriod
Represents a single month. This class is immutable, which is a requirement
for all
RegularTimePeriod
subclasses.
Month() - Constructs a new Month, based on the current system time.
|
Month(Date time) - Constructs a new month instance, based on a date/time and the default
time zone.
|
Month(Date time, 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.
|
int | compareTo(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(Object obj) - Tests the equality of this Month object to an arbitrary object.
|
long | getFirstMillisecond(Calendar calendar) - Returns the first millisecond of the month, evaluated using the supplied
calendar (which determines the time zone).
|
long | getLastMillisecond(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(String s) - Parses the string argument as a month.
|
RegularTimePeriod | previous() - Returns the month preceding this one.
|
String | toString() - Returns a string representing the month (e.g.
|
createInstance , downsize , getEnd , getFirstMillisecond , getFirstMillisecond , getFirstMillisecond , getLastMillisecond , getLastMillisecond , getLastMillisecond , getMiddleMillisecond , getMiddleMillisecond , getMiddleMillisecond , getSerialIndex , getStart , next , previous , toString |
Month
public Month()
Constructs a new Month, based on the current system time.
Month
public Month(Date time)
Constructs a new month instance, based on a date/time and the default
time zone.
Month
public Month(Date time,
TimeZone zone)
Constructs a Month, based on a date/time and a time zone.
time
- the date/time.zone
- the time zone.
Month
public Month(int month,
int year)
Constructs a new month instance.
month
- the month (in the range 1 to 12).year
- the year.
Month
public Month(int month,
Year year)
Constructs a new month instance.
month
- the month (in the range 1 to 12).year
- the year.
compareTo
public int compareTo(Object o1)
Returns an integer indicating the order of this Month object relative to
the specified
object: negative == before, zero == same, positive == after.
o1
- the object to compare.
- negative == before, zero == same, positive == after.
equals
public boolean equals(Object obj)
Tests the equality of this Month object to an arbitrary object.
Returns true if the target is a Month instance representing the same
month as this object. In all other cases, returns false.
true
if month and year of this and object are the
same.
getLastMillisecond
public long getLastMillisecond(Calendar calendar)
Returns the last millisecond of the month, evaluated using the supplied
calendar (which determines the time zone).
- getLastMillisecond in interface RegularTimePeriod
- The last millisecond of the month.
getMonth
public int getMonth()
Returns the month. Note that 1=JAN, 2=FEB, ...
getYear
public Year getYear()
Returns the year in which the month falls.
- The year in which the month falls (as a Year object).
getYearValue
public int getYearValue()
Returns the year in which the month falls.
- The year in which the monht falls (as an int).
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
parseMonth
public static Month parseMonth(String s)
Parses the string argument as a month.
This method is required to accept the format "YYYY-MM". It will also
accept "MM-YYYY". Anything else, at the moment, is a bonus.
null
if the string is not parseable, the month
otherwise.
toString
public String toString()
Returns a string representing the month (e.g. "January 2002").
To do: look at internationalisation.
- toString in interface RegularTimePeriod
- A string representing the month.