org.oddjob.schedules.schedules
Class BrokenSchedule

java.lang.Object
  extended byorg.oddjob.schedules.schedules.BrokenSchedule
All Implemented Interfaces:
Schedule, java.io.Serializable

public class BrokenSchedule
extends java.lang.Object
implements java.io.Serializable, Schedule

Description:
This schedule allows a normal schedule to be broken by the results of another schedule. This might be a list of bank holidays, or time of day, or any other schedule.

This schedule works by moving the schedule forward if the start time of the next interval falls within the next interval defined by the break. In the example below for a time of 12:00 on 24-dec-04 the logic is as follows:

Example:
 <broken>
   <schedule>
     <time on="10:00" />
   </schedule>
   <breaks>
     <date from="25-dec-04" to="26-dec-04" />
   </breaks>
 </broken>
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
BrokenSchedule()
           
 
Method Summary
 Schedule getBreaks()
          Get the breaks which will break up the schedule.
 Interval getLimits()
          Get any limits set for this schedule.
 Schedule getSchedule()
          Get the schedule to break up.
 Interval nextDue(ScheduleContext context)
          Implement the schedule.
 void setBreaks(Schedule breaks)
          Set the breaks which will break up the schedule.
 void setLimits(Interval limits)
          Specifies limits for the schedule.
 void setSchedule(Schedule schedule)
          Set the schedule to break up.
 java.lang.String toString()
          Provide a simple string description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BrokenSchedule

public BrokenSchedule()
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 #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.

setSchedule

public void setSchedule(Schedule schedule)
Set the schedule to break up.

Parameters:
schedule - The schedule to break up.

getSchedule

public Schedule getSchedule()
Get the schedule to break up.

Returns:
The schedule to break up.

setBreaks

public void setBreaks(Schedule breaks)
Set the breaks which will break up the schedule.

Parameters:
breaks - The breaks schedule.

getBreaks

public Schedule getBreaks()
Get the breaks which will break up the schedule.

Returns:
The break Schedule.

nextDue

public Interval nextDue(ScheduleContext context)
Implement the schedule.

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

toString

public java.lang.String toString()
Provide a simple string description.