|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.jrefinery.data.TimePeriod
com.jrefinery.data.Week
public class Week
Represents a week within a particular year.
This class is immutable, which is a requirement for all TimePeriod 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. |
protected int |
week
The week (1-52). |
protected Year |
year
The year in which the week falls. |
| Fields inherited from class com.jrefinery.data.TimePeriod |
|---|
DEFAULT_TIME_ZONE, WORKING_CALENDAR |
| Fields inherited from interface com.jrefinery.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 |
getEnd(java.util.Calendar calendar)
Returns the last millisecond of the week, evaluated using the supplied calendar (which determines the time zone). |
long |
getStart(java.util.Calendar calendar)
Returns the first millisecond of the week, evaluated using the supplied calendar (which determines the time zone). |
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. |
static void |
main(java.lang.String[] args)
Test code - please ignore. |
TimePeriod |
next()
Returns the week following this one. |
static Week |
parseWeek(java.lang.String s)
Parses the string argument as a week. |
TimePeriod |
previous()
Returns the week preceding this one. |
java.lang.String |
toString()
Returns a string representing the week (e.g. |
| Methods inherited from class com.jrefinery.data.TimePeriod |
|---|
getEnd, getEnd, getMiddle, getMiddle, getMiddle, getStart, getStart |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int FIRST_WEEK_IN_YEAR
public static int LAST_WEEK_IN_YEAR
protected Year year
protected int week
| Constructor Detail |
|---|
public Week()
public Week(int week,
int year)
week - The week (1 to 52).year - The year (1900 to 9999).
public Week(int week,
Year year)
week - The week (1 to 52).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 TimePeriod previous()
previous in class TimePeriodpublic TimePeriod next()
next in class TimePeriodpublic java.lang.String toString()
To do: look at internationalisation.
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobject - The object.public int compareTo(java.lang.Object o1)
public long getStart(java.util.Calendar calendar)
getStart in class TimePeriodcalendar - The calendar.
public long getEnd(java.util.Calendar calendar)
getEnd in class TimePeriodcalendar - The calendar.
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.
TimePeriodFormatExceptionpublic static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||