Package com.groiss.timer
Class ScheduleInfo
java.lang.Object
com.groiss.timer.ScheduleInfo
Define a schedule in a cron-like syntax.
-
Constructor Summary
ConstructorDescriptionScheduleInfo
(String pattern, Date firsttime) Create the schedule info object. -
Method Summary
Modifier and TypeMethodDescriptionCompute the next run of this schedule.getNextRun
(Date date) Compute the next run of this schedule.void
setFirstTime
(Date firsttime) Set the start time of the schedule.toString()
-
Constructor Details
-
ScheduleInfo
Create the schedule info object.- Parameters:
pattern
- a pattern in cron-syntax (see system adminstration guide, section Timer, for details) or an integer (as String object) defining the interval in seconds.firsttime
- the start of the schedule (may be null).
-
-
Method Details
-
setFirstTime
Set the start time of the schedule.- Parameters:
firsttime
- a date object
-
toString
-
getNextRun
Compute the next run of this schedule. Calls getNextRun(Date) with the current date.- Returns:
- the next schedule match, null if no schedule defined
-
getNextRun
Compute the next run of this schedule. It returns the first match of the pattern after timestamp x, where x is: If firsttime is not set or in past, use the argument date, else use firsttime.- Parameters:
date
- a date object- Returns:
- the next schedule match, null if no schedule defined
-