org.oddjob.schedules
Class ScheduleList

java.lang.Object
  extended by org.oddjob.schedules.ScheduleList
All Implemented Interfaces:
Serializable, Schedule

public final class ScheduleList
extends Object
implements Serializable, Schedule

Description

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

Example

Schedule on Monday and a Friday.
<schedules:list xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <schedules>
        <schedules:weekly on="Monday"/>
        <schedules:weekly on="Friday"/>
    </schedules>
</schedules:list>
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
ScheduleList()
           
 
Method Summary
 Schedule[] getSchedules()
           
 Schedule getSchedules(int index)
           
 ScheduleResult nextDue(ScheduleContext context)
          For a given date a schedule will provide the interval this schedule should next be scheduled in.
 void setSchedules(int index, Schedule schedule)
           
 void setSchedules(Schedule[] schedules)
           
 int size()
          The number of subschedules this list contains.
 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

setSchedules

public void setSchedules(int index,
                         Schedule schedule)

getSchedules

public Schedule getSchedules(int index)

setSchedules

public void setSchedules(Schedule[] schedules)

getSchedules

public Schedule[] getSchedules()

size

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

Returns:
The number of subschedules.

nextDue

public ScheduleResult nextDue(ScheduleContext context)
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
Returns:
The next due interval for the schedule.

toString

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

Overrides:
toString in class Object
Returns:
A description of the schedule.