org.treesched
Class ConstrainedSchedule

java.lang.Object
  extended byorg.treesched.AbstractSchedule
      extended byorg.treesched.ConstrainedSchedule
All Implemented Interfaces:
RefineableSchedule, Schedule, java.io.Serializable
Direct Known Subclasses:
DayOfMonthSchedule, DayOfWeekSchedule, DayOfYearSchedule, MonthSchedule, TimeSchedule

public abstract class ConstrainedSchedule
extends AbstractSchedule

A base class for a Schedule which has a from and a to date.

Author:
Rob Gordon
See Also:
Serialized Form

Constructor Summary
ConstrainedSchedule()
           
 
Method Summary
abstract  java.util.Date getEndDate(java.util.Date now)
          For the given time, calculate when this schedule interval should finish.
abstract  java.lang.String getFrom()
          Get the from date/time as a String.
abstract  java.util.Date getStartDate(java.util.Date now)
          For the given time, calculate when this schedule should start or should have started.
abstract  java.lang.String getTo()
          Get the to date/time as a String.
 Interval nextDue(java.util.Date now)
          For a given date a schedule will provide the interval this schedule should next be scheduled in.
abstract  void setFrom(java.lang.String from)
          Set the from date/time as a String.
 void setOn(java.lang.String on)
          Set the on date as a string.
abstract  void setTo(java.lang.String to)
          Set the to date/time as a String.
 java.lang.String toString()
          Override toString.
 
Methods inherited from class org.treesched.AbstractSchedule
addChildSchedule, getChildSchedule, getLimits, reset, setChildSchedule, setLimits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstrainedSchedule

public ConstrainedSchedule()
Method Detail

setFrom

public abstract void setFrom(java.lang.String from)
                      throws java.text.ParseException
Set the from date/time as a String.

Parameters:
from - The from date.
Throws:
java.text.ParseException - If the String can not be parsed to a date.

getFrom

public abstract java.lang.String getFrom()
Get the from date/time as a String.

Returns:
The from date.

setTo

public abstract void setTo(java.lang.String to)
                    throws java.text.ParseException
Set the to date/time as a String.

Parameters:
to - The to date.
Throws:
java.text.ParseException - If the String can not be parsed to a date.

getTo

public abstract java.lang.String getTo()
Get the to date/time as a String.

Returns:
The to date.

getStartDate

public abstract java.util.Date getStartDate(java.util.Date now)
For the given time, calculate when this schedule should start or should have started.

Parameters:
now - The date/time now.
Returns:
The date/time the scheudle is/was due.

getEndDate

public abstract java.util.Date getEndDate(java.util.Date now)
For the given time, calculate when this schedule interval should finish.

Parameters:
now - The date/time now.
Returns:
The date/time the schedule should finish.

setOn

public void setOn(java.lang.String on)
           throws java.text.ParseException
Set the on date as a string.

Throws:
java.text.ParseException - If the string isn't a date.

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.

Parameters:
now - The date now.
Returns:
The next due interval for the schedule.

toString

public java.lang.String toString()
Override toString.

Returns:
A description of the schedule.