com.espertech.esper.schedule
Class ScheduleComputeHelper
java.lang.Object
com.espertech.esper.schedule.ScheduleComputeHelper
public final class ScheduleComputeHelper
- extends java.lang.Object
For a crontab-like schedule, this class computes the next occurance given a start time and a specification of
what the schedule looks like.
The resolution at which this works is at the second level. The next occurance
is always at least 1 second ahead.
The class implements an algorithm that starts at the highest precision (seconds) and
continues to the lowest precicion (month). For each precision level the
algorithm looks at the list of valid values and finds a value for each that is equal to or greater then
the valid values supplied. If no equal or
greater value was supplied, it will reset all higher precision elements to its minimum value.
Method Summary |
static long |
computeDeltaNextOccurance(ScheduleSpec spec,
long afterTimeInMillis)
Computes the next lowest date in milliseconds based on a specification and the
from-time passed in and returns the delta from the current time. |
static long |
computeNextOccurance(ScheduleSpec spec,
long afterTimeInMillis)
Computes the next lowest date in milliseconds based on a specification and the
from-time passed in. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScheduleComputeHelper
public ScheduleComputeHelper()
computeNextOccurance
public static long computeNextOccurance(ScheduleSpec spec,
long afterTimeInMillis)
- Computes the next lowest date in milliseconds based on a specification and the
from-time passed in.
- Parameters:
spec
- defines the scheduleafterTimeInMillis
- defines the start time
- Returns:
- a long date millisecond value for the next schedule occurance matching the spec
computeDeltaNextOccurance
public static long computeDeltaNextOccurance(ScheduleSpec spec,
long afterTimeInMillis)
- Computes the next lowest date in milliseconds based on a specification and the
from-time passed in and returns the delta from the current time.
- Parameters:
spec
- defines the scheduleafterTimeInMillis
- defines the start time
- Returns:
- a long millisecond value representing the delta between current time and the next schedule occurance matching the spec