public class Month extends RegularTimePeriod implements Serializable
RegularTimePeriod
subclasses.DEFAULT_TIME_ZONE, WORKING_CALENDAR
Constructor and Description |
---|
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)
Deprecated.
Since 1.0.12, use
Month(Date, TimeZone, Locale)
instead. |
Month(Date time,
TimeZone zone,
Locale locale)
Creates a new
Month instance, based on the specified time,
zone and locale. |
Month(int month,
int year)
Constructs a new month instance.
|
Month(int month,
Year year)
Constructs a new month instance.
|
Modifier and Type | Method and Description |
---|---|
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()
Returns the first millisecond of the month.
|
long |
getFirstMillisecond(Calendar calendar)
Returns the first millisecond of the month, evaluated using the supplied
calendar (which determines the time zone).
|
long |
getLastMillisecond()
Returns the last millisecond of the month.
|
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.
|
void |
peg(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 month preceding this one.
|
String |
toString()
Returns a string representing the month (e.g.
|
createInstance, downsize, getEnd, getFirstMillisecond, getLastMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMiddleMillisecond, getMillisecond, getStart
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(Date time)
Month
instance, based on a date/time and
the default time zone.time
- the date/time (null
not permitted).Month(Date, TimeZone)
public Month(Date time, TimeZone zone)
Month(Date, TimeZone, Locale)
instead.Month
instance, based on a date/time and
a time zone. The first and last millisecond values are initially
pegged to the given time zone also.time
- the date/time.zone
- the time zone (null
not permitted).public Year getYear()
public int getYearValue()
public int getMonth()
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(Calendar calendar)
peg
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).public RegularTimePeriod previous()
Month
is "pegged" using the default time-zone, irrespective of
the time-zone used to peg of the current month (which is not recorded
anywhere). See the peg(Calendar)
method.previous
in class RegularTimePeriod
public RegularTimePeriod next()
Month
is "pegged" using the default time-zone, irrespective of
the time-zone used to peg of the current month (which is not recorded
anywhere). See the peg(Calendar)
method.next
in class RegularTimePeriod
public long getSerialIndex()
getSerialIndex
in class RegularTimePeriod
public String toString()
To do: look at internationalisation.
toString
in class RegularTimePeriod
public boolean equals(Object obj)
public int hashCode()
http://developer.java.sun.com/developer/Books/effectivejava
/Chapter3.pdf
public int compareTo(Object o1)
compareTo
in interface Comparable
o1
- the object to compare.public long getFirstMillisecond(Calendar calendar)
getFirstMillisecond
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).NullPointerException
- if calendar
is
null
.RegularTimePeriod.getLastMillisecond(Calendar)
public long getLastMillisecond(Calendar calendar)
getLastMillisecond
in class RegularTimePeriod
calendar
- the calendar (null
not permitted).NullPointerException
- if calendar
is
null
.RegularTimePeriod.getFirstMillisecond(Calendar)
public static Month parseMonth(String s)
s
- the string to parse (null
permitted).null
if the string is not parseable, the month
otherwise.Jas4pp 1.5 © Java Analysis Studio for Particle Physics