|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prozima.time.TimeTable
public class TimeTable
A timetable stores periods of time, which are referenced by date or by day of the week. The significance of each time period depends on the application which utilises this class. Time periods, which are defined for a specific date, take precedence over periods defined for a day of the week. If no periods have been defined for a specific date or the day of the week it falls on, then there are no periods available for this date.
When time periods are stored for a day of the week, they are associated with
an era. Eras allow day specified time periods to vary with time. Each era is associated with
a starting date from which the era applies. Dates on or after this starting date use the day of the week
periods which correspond to that era. In this way, patterns of time periods which vary through
time may be created. Each era applies until the starting date of the following era, if one is
specified. By default there is a default era defined, which has ID DEFAULT_ERA_ID.
As date specified time periods take precedence over day specified periods, it is necessary to
specify when no time periods are available for a specific date and that the day of week periods
should not be used. The method setIsUnavailable(int, int) allows a specific date
to be flagged as having no time periods available.
| Field Summary | |
|---|---|
static int |
DEFAULT_ERA_ID
ID of the default Era. |
| Constructor Summary | |
|---|---|
TimeTable()
Create a new instance of a time table. |
|
| Method Summary | |
|---|---|
boolean |
addTimePeriod(int inYear,
int inDayOfYear,
TimePeriod inTimePeriod)
Set a time period for a specific date. |
boolean |
addTimePeriod(int inEraID,
TimeConstants.DayOfWeek inDay,
TimePeriod inTimePeriod)
Set a time period for a day of the week. |
void |
clearTimePeriods(int inYear,
int inDayOfYear)
Clear all the stored time periods for a specific date. |
void |
clearTimePeriods(TimeConstants.DayOfWeek inDay)
Clear all the stored time periods for a day of the week. |
TimeTable |
clone()
|
static TimeTable |
combine(TimeTable inBase,
TimeTable inOther)
Combine two TimeTables into one. |
java.lang.Integer |
createEra(DayAndYear inStart)
Create a new Era which is used to control DayOfWeek time periods. |
boolean |
equals(java.lang.Object inObject)
|
java.lang.Integer |
findEraID(DayAndYear inStart)
Reverse lookup the Era ID which corresponds to an Era starting date. |
java.util.Set<java.lang.Integer> |
getAllEraIDs()
Get set of all defined Era IDs. |
java.util.List<TimePeriod> |
getAllTimePeriods(java.util.Date inStartDate,
int inDuration)
Get all the time periods between a start time and end time of a specific day. |
DayAndYear |
getEarliestDate()
Get the earliest date currently used to index a TimePeriod. |
DayAndYear |
getLatestDate()
Get the latest date currently used to index a TimePeriod. |
java.util.Set<DayAndYear> |
getModifiedDates()
Get all the specific days for which this TimeTable has time periods. |
java.util.List<TimePeriod> |
getTimePeriods(DayAndYear inDayAndYear)
Get a list of the time periods stored for a specific date. |
java.util.List<TimePeriod> |
getTimePeriods(int inYear,
int inDayOfYear)
Get a list of the time periods stored for a specific date. |
java.util.List<TimePeriod> |
getTimePeriods(int inEraID,
TimeConstants.DayOfWeek inDayOfWeek)
Get a list of the time periods for a specific Day of the Week. |
int |
getTotalDuration(java.util.Date inStart,
int inDuration)
Get the total duration of time periods between a Start time and End time of the same day. |
int |
hashCode()
|
boolean |
removeEra(int inEraID)
Remove a previously created Era. |
void |
setIsUnavailable(int inYear,
int inDayOfYear)
Set a date as having no available time periods. |
boolean |
subtractTimePeriod(int inYear,
int inDayOfYear,
TimePeriod inTimePeriod)
Subtract a time period for a specific date. |
boolean |
subtractTimePeriod(int inEraID,
TimeConstants.DayOfWeek inDay,
TimePeriod inTimePeriod)
Subtract a time period for a day of the week. |
java.lang.String |
toString()
Display full contents of the timetable in text format. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_ERA_ID
| Constructor Detail |
|---|
public TimeTable()
| Method Detail |
|---|
public boolean addTimePeriod(int inYear,
int inDayOfYear,
TimePeriod inTimePeriod)
inYear - Year in Calendar.YEAR format.inDayOfYear - Day of the year in Calendar.DAY_OF_YEAR format.inTimePeriod - A time period which is to be stored.
public boolean addTimePeriod(int inEraID,
TimeConstants.DayOfWeek inDay,
TimePeriod inTimePeriod)
inEraID - ID of the Era.inDay - A specific day of the week.inTimePeriod - A time period.
public void clearTimePeriods(int inYear,
int inDayOfYear)
inYear - Year in Calendar.YEAR format.inDayOfYear - Day of the year in Calendar.DAY_OF_YEAR format.public void clearTimePeriods(TimeConstants.DayOfWeek inDay)
inDay - A day of the week.
public TimeTable clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException
public static final TimeTable combine(TimeTable inBase,
TimeTable inOther)
inBase - Base TimeTable - lowest priority.inOther - TimeTable with highest priority.
public java.lang.Integer createEra(DayAndYear inStart)
inStart - Start of the era.
public boolean equals(java.lang.Object inObject)
equals in class java.lang.Objectpublic java.lang.Integer findEraID(DayAndYear inStart)
inStart - Start date of the Era. If parameter is null
then method will return null.
public java.util.Set<java.lang.Integer> getAllEraIDs()
public java.util.List<TimePeriod> getAllTimePeriods(java.util.Date inStartDate,
int inDuration)
inStartDate - Start date and time.inDuration - Duration of period to be examined in Minutes. Zero duration will result
in empty result list. Must not be a negative number.
public DayAndYear getEarliestDate()
addTimePeriod(int, int, TimePeriod).
public DayAndYear getLatestDate()
addTimePeriod(int, int, TimePeriod).
public java.util.Set<DayAndYear> getModifiedDates()
public java.util.List<TimePeriod> getTimePeriods(DayAndYear inDayAndYear)
inDayAndYear - Specific day and year.
public java.util.List<TimePeriod> getTimePeriods(int inYear,
int inDayOfYear)
inYear - Year in Calendar.YEAR format.inDayOfYear - Day of the year in Calendar.DAY_OF_YEAR format.
public java.util.List<TimePeriod> getTimePeriods(int inEraID,
TimeConstants.DayOfWeek inDayOfWeek)
inEraID - ID of the Era.inDayOfWeek - Day of the week.
public int getTotalDuration(java.util.Date inStart,
int inDuration)
inStart - Start date/time.inDuration - Duration of period being checked.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean removeEra(int inEraID)
inEraID - ID of the Era.
public void setIsUnavailable(int inYear,
int inDayOfYear)
inYear - Year in Calendar.YEAR format.inDayOfYear - Day of the year in Calendar.DAY_OF_YEAR format.
public boolean subtractTimePeriod(int inYear,
int inDayOfYear,
TimePeriod inTimePeriod)
inYear - Year in Calendar.YEAR format.inDayOfYear - Day of the year in Calendar.DAY_OF_YEAR format.inTimePeriod - A time period.
public boolean subtractTimePeriod(int inEraID,
TimeConstants.DayOfWeek inDay,
TimePeriod inTimePeriod)
inEraID - ID of the Era.inDay - A day of the week.inTimePeriod - A time period which is to be subtracted.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||