|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.util.Schedule
public class Schedule
This class implements ISchedule. There is a set of fields which are public that represent what this schedule is. These can be set by individually or you can use the parser to parse A schedule string (see bottom for syntax). Fields which are not used must remain null. Be very careful when setting the fields individually, the getNextDate() method is very picky about how the fields are set. The getScheduleString() method returns a string which is guaranteed to be parsable by the Schedule parser. You can pass a TimeZone object into the constructor and this Schedule will take place in that time zone.
DateTime Schedule Notation. date = mm/dd/yyyy time = hh:mm:ss [starting startDateTime] [every n[y|m|w|d]] | [on [[SU][MO][TU][WE][TH][FI][SA]] | [startDay-endDay]]] [between startTime-endTime every n[h|m|s]] | [at time1, time2, time3, ...] [until endDateTime] [starting startDateTime] [[every n[y|m|w|d]] | [on [[SU][MO][TU][WE][TH][FR][SA] | [startDay-endDay]]]] [[between startTime-endTime every n[h|m|s]] | [at time1,time2,time3]] [until endDateTime]
| Field Summary | |
|---|---|
java.util.Vector |
atTimes
atTimes: This is a vector of Date objects which hold hours,minutes,and seconds of times to schedule. |
static int |
CUSTOM
|
boolean[] |
dayMap
dayMap[]: This is the days of the week, true=Schedule on this day OK, false=No Schedules on this day |
java.util.Date |
endDate
endDate: This is when to end this schedule, time values are not valid. |
java.util.Date |
endTime
endTime: This is the ending time, hours,minutes,seconds. |
static int |
EVERY_12_HOURS
|
static int |
EVERY_3_HOURS
|
static int |
EVERY_DAY
|
static int |
EVERY_HALF_HOUR
|
static int |
EVERY_HOUR
|
static int |
EVERY_MINUTE
These are static constants |
static int |
EVERY_TEN_MINUTES
|
static int |
EVERY_WEEK
|
int |
everyDate
everyDate: This is the number of iterations to make of everyDateType |
int |
everyDateType
everyDateType: This is either y,m,w,d (kYears, kMonths, kWeeks, kDays) |
int |
everyTime
everyTime: This is like everyDate, except iterations on time, not dates |
int |
everyTimeType
everyTimeType: This is either h,m,s (kHours,kMinutes,kSeconds) |
boolean |
isValid
|
static int |
kDays
|
static int |
kHours
|
static int |
kMinutes
|
static int |
kMonths
|
static int |
kSeconds
|
static int |
kWeeks
|
static int |
kYears
|
int |
maximumLatency
maximumLatency: This is the maximum number of milliseconds this schedule can be delayed. |
java.util.Date |
startDate
startDate: The Year,Month,Week,and Date of the starting Date. |
java.util.Date |
startTime
startTime: This is the Hour,Minutes,Seconds of the starting time, date values are not valid |
| Constructor Summary | |
|---|---|
Schedule()
You get a Schedule class that is not valid, with TimeZone set to default. |
|
Schedule(java.lang.String input)
This does the parse for you and sets timezone to host's default. |
|
Schedule(java.lang.String input,
java.util.TimeZone tz)
This does the parse for you and sets the timezone to whatever is passed in. |
|
| Method Summary | |
|---|---|
protected void |
debug(java.lang.String s)
|
protected void |
error(java.lang.String s)
|
protected void |
error(java.lang.String s,
java.lang.Exception e)
|
long |
getMaximumLatency()
Returns the maximum number of milliseconds each event in this schedule can be delayed before timing out. |
java.util.Date |
getNextDate(java.util.Date startingAt)
This returns the next date something is supposed to happen according to the schedule |
java.util.Date |
getNextDate(java.util.Date startingAt,
int recurse)
This returns the next date something is supposed to happen according to the schedule |
java.util.Date |
getNextTime(java.util.Date startingAt,
java.util.Date dateReference)
This returns a date with useless information about dates, but valid info on time |
java.lang.String |
getScheduleString()
This is the same as toString() except this is parsable and can be reused by another schedule |
int |
getScheduleType()
|
boolean |
isValid()
This returns the validity of the current schedule |
static void |
main(java.lang.String[] args)
|
protected static void |
print(java.lang.String s)
|
void |
setMaximumLatency(int milliseconds)
|
boolean |
setSchedule(java.lang.String input)
This resets the schedule, removing the current settings, then parses the Schedule String and sets the state variables. |
void |
setTimeZone(java.util.TimeZone tz)
This sets the timezone for this schedule. |
java.lang.String |
toString()
This returns an Enlgish description of the Schedule |
void |
update(com.cometway.util.Schedule.pNode pStartDate,
com.cometway.util.Schedule.pNode pEveryDate,
com.cometway.util.Schedule.pNode pEveryDateType,
com.cometway.util.Schedule.pNode pDayMap,
com.cometway.util.Schedule.pNode pStartTime,
com.cometway.util.Schedule.pNode pEndTime,
com.cometway.util.Schedule.pNode pEveryTime,
com.cometway.util.Schedule.pNode pEveryTimeType,
com.cometway.util.Schedule.pNode pAtTimes,
com.cometway.util.Schedule.pNode pEndDate)
This function parses the data in each node and stores the information in the appropriate type in the appropriate field. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public java.util.Date startDate
public int everyDate
public int everyDateType
public boolean[] dayMap
public java.util.Date startTime
public java.util.Date endTime
public int everyTime
public int everyTimeType
public java.util.Vector atTimes
public java.util.Date endDate
public int maximumLatency
public static final int EVERY_MINUTE
public static final int EVERY_TEN_MINUTES
public static final int EVERY_HALF_HOUR
public static final int EVERY_HOUR
public static final int EVERY_3_HOURS
public static final int EVERY_12_HOURS
public static final int EVERY_DAY
public static final int EVERY_WEEK
public static final int CUSTOM
public static final int kYears
public static final int kMonths
public static final int kWeeks
public static final int kDays
public static final int kHours
public static final int kMinutes
public static final int kSeconds
public boolean isValid
| Constructor Detail |
|---|
public Schedule()
public Schedule(java.lang.String input)
public Schedule(java.lang.String input,
java.util.TimeZone tz)
| Method Detail |
|---|
public boolean isValid()
isValid in interface ISchedulepublic boolean setSchedule(java.lang.String input)
setSchedule in interface IScheduleinput - This string is parsed as the schedule description
public void setTimeZone(java.util.TimeZone tz)
public java.util.Date getNextDate(java.util.Date startingAt)
getNextDate in interface ISchedulestaringAt - This is the reference date and time which to base results
public java.util.Date getNextDate(java.util.Date startingAt,
int recurse)
staringAt - This is the reference date and time which to base resultsrecurse - A panic detector.
public java.util.Date getNextTime(java.util.Date startingAt,
java.util.Date dateReference)
startingAt - This is the reference to try to exceeddateReference - This is the date reference to use for comparison
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getScheduleString()
getScheduleString in interface ISchedule
public void update(com.cometway.util.Schedule.pNode pStartDate,
com.cometway.util.Schedule.pNode pEveryDate,
com.cometway.util.Schedule.pNode pEveryDateType,
com.cometway.util.Schedule.pNode pDayMap,
com.cometway.util.Schedule.pNode pStartTime,
com.cometway.util.Schedule.pNode pEndTime,
com.cometway.util.Schedule.pNode pEveryTime,
com.cometway.util.Schedule.pNode pEveryTimeType,
com.cometway.util.Schedule.pNode pAtTimes,
com.cometway.util.Schedule.pNode pEndDate)
public static void main(java.lang.String[] args)
public long getMaximumLatency()
ISchedule
getMaximumLatency in interface ISchedulepublic void setMaximumLatency(int milliseconds)
public int getScheduleType()
protected static void print(java.lang.String s)
protected void error(java.lang.String s)
protected void error(java.lang.String s,
java.lang.Exception e)
protected void debug(java.lang.String s)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||