org.treesched.schedules
Class BrokenSchedule

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

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

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.

Typical configuration would be:

 <broken>
   <schedule>
     <daily/>
   </schedule>
   <breaks>
     <date from="25-dec-04" to="26-dec-04"/>
   </breaks>
 </broken>

Author:
Rob Gordon
See Also:
Serialized Form

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(java.util.Date now)
          Implement the schedule.
 void reset()
          Reset 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 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.

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(java.util.Date now)
Implement the schedule.

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 schedule.

Specified by:
reset in interface Schedule

toString

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