package org.treesched;

import java.util.Date;



/**
 * The interface that defines a schedule.
 * 
 * @author Rob Gordon
 */

public interface Schedule {

	/**
	 * For a given date a schedule will provide the interval this schedule
	 * should next be scheduled in.
	 * <p>
	 * If the schedule is never due again for the given date,
	 * null is returned.
	 * <p>
	 * @param now The date now.
	 * @return The next due interval for the schedule.
	 */
	public Interval nextDue(Date now);

	/**
	 * Specifies limits for the schedule. If they are set
	 * then the start of the interval return by {@link #nextDue(Date)}
	 * must be within the limits.
	 * <p>
	 * A repeating schedule will also use the start of the limit
	 * to calculate the boundry between intervals.
	 * 
	 * @param limits The interval which bounds the schedule.
	 */
	public void setLimits(Interval limits);
	
	/**
	 * Reset the schedule. This allows schedules which contain state, such
	 * as count to be reset.
	 */
	public void reset();
}
