|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.sauronsoftware.cron4j.Predictor
public class Predictor
A predictor is able to predict when a scheduling pattern will be matched.
Suppose you want to know when the scheduler will execute a task scheduled with the pattern 0 3 * jan-jun,sep-dec mon-fri. You can predict the next n execution of the task using a Predictor instance:
String pattern = "0 3 * jan-jun,sep-dec mon-fri"; Predictor p = new Predictor(pattern); for (int i = 0; i < n; i++) { System.out.println(p.nextMatchingDate()); }
Constructor Summary | |
---|---|
Predictor(SchedulingPattern schedulingPattern)
It builds a predictor with the given scheduling pattern and the current system time as the prediction start time. |
|
Predictor(SchedulingPattern schedulingPattern,
java.util.Date start)
It builds a predictor with the given scheduling pattern and start time. |
|
Predictor(SchedulingPattern schedulingPattern,
long start)
It builds a predictor with the given scheduling pattern and start time. |
|
Predictor(java.lang.String schedulingPattern)
It builds a predictor with the given scheduling pattern and the current system time as the prediction start time. |
|
Predictor(java.lang.String schedulingPattern,
java.util.Date start)
It builds a predictor with the given scheduling pattern and start time. |
|
Predictor(java.lang.String schedulingPattern,
long start)
It builds a predictor with the given scheduling pattern and start time. |
Method Summary | |
---|---|
java.util.Date |
nextMatchingDate()
It returns the next matching moment as a Date object. |
long |
nextMatchingTime()
It returns the next matching moment as a millis value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Predictor(java.lang.String schedulingPattern, long start) throws InvalidPatternException
schedulingPattern
- The pattern on which the prediction will be based.start
- The start time of the prediction.
InvalidPatternException
- In the given scheduling pattern isn't valid.public Predictor(java.lang.String schedulingPattern, java.util.Date start) throws InvalidPatternException
schedulingPattern
- The pattern on which the prediction will be based.start
- The start time of the prediction.
InvalidPatternException
- In the given scheduling pattern isn't valid.public Predictor(java.lang.String schedulingPattern) throws InvalidPatternException
schedulingPattern
- The pattern on which the prediction will be based.
InvalidPatternException
- In the given scheduling pattern isn't valid.public Predictor(SchedulingPattern schedulingPattern, long start)
schedulingPattern
- The pattern on which the prediction will be based.start
- The start time of the prediction.public Predictor(SchedulingPattern schedulingPattern, java.util.Date start)
schedulingPattern
- The pattern on which the prediction will be based.start
- The start time of the prediction.public Predictor(SchedulingPattern schedulingPattern)
schedulingPattern
- The pattern on which the prediction will be based.Method Detail |
---|
public long nextMatchingTime()
public java.util.Date nextMatchingDate()
Date
object.
Date
object.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |