public abstract class ConstrainedSchedule extends AbstractSchedule
Constructor and Description |
---|
ConstrainedSchedule() |
Modifier and Type | Method and Description |
---|---|
protected abstract Calendar |
fromCalendar(Date referenceDate,
TimeZone timeZone)
Provide a Calendar for the start of the constraint.
|
protected abstract CalendarUnit |
intervalBetween()
Sub classes must provide a unit which is what must be
added to move the schedule on.
|
protected Interval |
lastInterval(ScheduleContext context)
Calculate the last interval.
|
ScheduleResult |
nextDue(ScheduleContext context)
For a given date a schedule will provide the interval this schedule
should next be scheduled in.
|
protected Interval |
nextInterval(ScheduleContext context)
Calculate the next interval, without children.
|
protected Calendar |
shiftFromCalendar(Calendar calendar,
int intervals)
Shift the from Calendar by an interval.
|
protected Calendar |
shiftToCalendar(Calendar calendar,
int intervals)
Shift the to Calendar by an interval.
|
protected abstract Calendar |
toCalendar(Date referenceDate,
TimeZone timeZone)
Provide a Calendar for the end of the constraint.
|
abstract String |
toString()
Force sub classes to override toString.
|
getRefinement, setRefinement
protected abstract Calendar fromCalendar(Date referenceDate, TimeZone timeZone)
referenceDate
- The date/time now.timeZone
- The time zone.protected abstract Calendar toCalendar(Date referenceDate, TimeZone timeZone)
referenceDate
- The date/time now.timeZone
- The time zone.protected abstract CalendarUnit intervalBetween()
protected final Interval nextInterval(ScheduleContext context)
context
- protected final Interval lastInterval(ScheduleContext context)
context
- protected Calendar shiftFromCalendar(Calendar calendar, int intervals)
calendar
- interval.
- protected Calendar shiftToCalendar(Calendar calendar, int intervals)
shiftFromCalendar(Calendar, int)
calendar
- intervals
- public ScheduleResult nextDue(ScheduleContext context)
Schedule
If the schedule is never due again for the given date, null is returned.