org.treesched
Class ScheduleList

java.lang.Object
  extended byorg.treesched.ScheduleList
All Implemented Interfaces:
RefineableSchedule, Schedule, java.io.Serializable

public final class ScheduleList
extends java.lang.Object
implements java.io.Serializable, RefineableSchedule

Provide a schedule based on a list of schedules. All schedules are evaluated and that schedule which is due to start first is used.

Most schedules use this class to support a list of child scheudules such as this.

 <schedule>
   <day-of-week on="mon"/>
   <day-of-week on="fri"/>
 </schedule>
 

Author:
Rob Gordon
See Also:
Serialized Form

Constructor Summary
ScheduleList()
           
 
Method Summary
 void addChildSchedule(Schedule schedule)
          Add a schedule to the list.
 Interval getLimits()
          Get any limits set for this schedule.
 Interval nextDue(java.util.Date now)
          For a given date a schedule will provide the interval this schedule should next be scheduled in.
 void reset()
          Reset the child schedules.
 void setLimits(Interval limits)
          Specifies limits for the schedule.
 int size()
          The number of subschedules this list contains.
 java.lang.String toString()
          Override toString to be more useful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduleList

public ScheduleList()
Method Detail

setLimits

public void setLimits(Interval limits)
Description copied from interface: Schedule
Specifies limits for the schedule. If they are set then the start of the interval return by Schedule.nextDue(Date) must be within the limits.

A repeating schedule will also use the start of the limit to calculate the boundry between intervals.

Specified by:
setLimits in interface Schedule
Parameters:
limits - The interval which bounds the schedule.

getLimits

public Interval getLimits()
Get any limits set for this schedule.

Returns:
The limits, may be null.

size

public int size()
The number of subschedules this list contains.

Returns:
The number of subschedules.

addChildSchedule

public void addChildSchedule(Schedule schedule)
Add a schedule to the list.

Specified by:
addChildSchedule in interface RefineableSchedule
Parameters:
schedule - The schedule to add.

nextDue

public Interval nextDue(java.util.Date now)
Description copied from interface: Schedule
For a given date a schedule will provide the interval this schedule should next be scheduled in.

If the schedule is never due again for the given date, null is returned.

Specified by:
nextDue in interface Schedule
Parameters:
now - The date now.
Returns:
The next due interval for the schedule.

reset

public void reset()
Reset the child schedules.

Specified by:
reset in interface Schedule

toString

public java.lang.String toString()
Override toString to be more useful.

Returns:
A description of the schedule.