|
||||||||||
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.Week
Represents a week within a particular year.
A year will have 52 or 53 weeks. Sometimes the first week of the year actually starts in the
previous year - see the Javadocs for GregorianCalendar
for details.
This class is immutable, which is a requirement for all RegularTimePeriod
subclasses.
Field Summary | |
static int |
FIRST_WEEK_IN_YEAR
Constant for the first week in the year. |
static int |
LAST_WEEK_IN_YEAR
Constant for the last week in the year. |
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 | |
Week()
Constructs a Week, based on the system date/time. |
|
Week(java.util.Date time)
Constructs a time period representing a week. |
|
Week(java.util.Date time,
java.util.TimeZone zone)
Constructs a Week, based on a date/time and a time zone. |
|
Week(int week,
int year)
Constructs a time period representing the week in the specified year. |
|
Week(int week,
Year year)
Constructs a time period representing the week in the specified year. |
Method Summary | |
int |
compareTo(java.lang.Object o1)
Returns an integer indicating the order of this Week object relative to the specified object: negative == before, zero == same, positive == after. |
boolean |
equals(java.lang.Object obj)
Tests the equality of this Week object to an arbitrary object. |
long |
getFirstMillisecond(java.util.Calendar calendar)
Returns the first millisecond of the week, evaluated using the supplied calendar (which determines the time zone). |
long |
getLastMillisecond(java.util.Calendar calendar)
Returns the last millisecond of the week, evaluated using the supplied calendar (which determines the time zone). |
long |
getSerialIndex()
Returns a serial index number for the week. |
int |
getWeek()
Returns the week. |
Year |
getYear()
Returns the year in which the week falls. |
int |
getYearValue()
Returns the year in which the week falls, as an integer value. |
RegularTimePeriod |
next()
Returns the week following this one. |
static Week |
parseWeek(java.lang.String s)
Parses the string argument as a week. |
RegularTimePeriod |
previous()
Returns the week preceding this one. |
java.lang.String |
toString()
Returns a string representing the week (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, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FIRST_WEEK_IN_YEAR
public static final int LAST_WEEK_IN_YEAR
Constructor Detail |
public Week()
public Week(int week, int year)
week
- the week (1 to 53).year
- the year (1900 to 9999).public Week(int week, Year year)
week
- the week (1 to 53).year
- the year (1900 to 9999).public Week(java.util.Date time)
time
- the time.public Week(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 getWeek()
public RegularTimePeriod previous()
previous
in class RegularTimePeriod
public RegularTimePeriod next()
next
in class RegularTimePeriod
public long getSerialIndex()
getSerialIndex
in class RegularTimePeriod
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 java.lang.String toString()
To do: look at internationalisation.
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object.
true
if week and year of this and object are the same.public int compareTo(java.lang.Object o1)
compareTo
in interface java.lang.Comparable
o1
- the object to compare.
public static Week parseWeek(java.lang.String s) throws TimePeriodFormatException
This method is required to accept the format "YYYY-Wnn". It will also accept "Wnn-YYYY". Anything else, at the moment, is a bonus.
s
- string to parse.
null
if the string is not parseable, the week otherwise.
TimePeriodFormatException
- if there is a problem parsing the string.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |