1 package org.oddjob.schedules; 2 3 import java.util.Date; 4 5 6 7 /** 8 * The interface that defines a schedule. 9 * 10 * @author Rob Gordon 11 */ 12 13 public interface Schedule { 14 15 /** 16 * For a given date a schedule will provide the interval this schedule 17 * should next be scheduled in. 18 * <p> 19 * If the schedule is never due again for the given date, 20 * null is returned. 21 * <p> 22 * @param now The date now. 23 * @return The next due interval for the schedule. 24 */ 25 public Interval nextDue(ScheduleContext context); 26 27 /** 28 * Specifies limits for the schedule. If they are set 29 * then the start of the interval return by {@link #nextDue(Date)} 30 * must be within the limits. 31 * <p> 32 * A repeating schedule will also use the start of the limit 33 * to calculate the boundry between intervals. 34 * 35 * @param limits The interval which bounds the schedule. 36 */ 37 public void setLimits(Interval limits); 38 39 } 40