org.treesched.schedules
Class CountSchedule
java.lang.Object
org.treesched.AbstractSchedule
org.treesched.schedules.CountSchedule
- All Implemented Interfaces:
- RefineableSchedule, Schedule, java.io.Serializable
- public final class CountSchedule
- extends AbstractSchedule
- implements java.io.Serializable
This schedule returns up to count number of child schedules. It is typically
used to count a number intervals for re-trying something, But could be used to count
the first n days of the month for instance.
The count will be reset if the end interval changes, i.e. when counting n days of the month,
and the month moves on. However in the retry situation to reset the count schedule it would
need to be reset.
Typical configuration would be:
<count count="5">
<interval interval="00:15"/>
</count>
- Author:
- Rob Gordon
- See Also:
- Serialized Form
|
Method Summary |
java.lang.String |
getCount()
Get the number to count to. |
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 count. |
void |
setCount(java.lang.String count)
Set the number to count to. |
java.lang.String |
toString()
Override toString to be more meaningful. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CountSchedule
public CountSchedule()
setCount
public void setCount(java.lang.String count)
- Set the number to count to.
- Parameters:
count - The number to count to.
getCount
public java.lang.String getCount()
- Get the number to count to.
- Returns:
- The number to count to.
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 count.
- Specified by:
reset in interface Schedule- Overrides:
reset in class AbstractSchedule
toString
public java.lang.String toString()
- Override toString to be more meaningful.