Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.treesched.schedules
Class DateSchedule

    java.lang.Object
      org.treesched.AbstractSchedule
          org.treesched.schedules.DateSchedule

All Implemented Interfaces:
  RefineableSchedule, Schedule, java.io.Serializable

public final class DateSchedule
extends AbstractSchedule
implements java.io.Serializable

Provide a schedule for a specific date or between two dates.

Allowed attributes:

format | The date format to use to parse the other attributes. | Optional
from | The from date for the schedule. Defaults to the the 0 java date. | Optional
to | The to date for the schedule. Defaults to the max java date. | Optional
on | A specific date on which to provide the schedule. | Optional

Any number of nested sub schedules are allowed.

typical configuration is: ``

     <date on="25-dec-04"/>

Author:
  Rob Gordon
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `DEFAULT_DATE_FORMAT`

Constructor Summary
`DateSchedule()`

Method Summary
`java.util.Date` | `getEndDate(java.util.Date now)` Return the end date.
`java.lang.String` | `getFormat()` Get the date format used for translating string attributes.
`java.lang.String` | `getFrom()` Get the from Date as a String.
`java.util.Date` | `getStartDate(java.util.Date now)` Return the start date.
`java.lang.String` | `getTo()` Return the to date 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.
`void` | `setFormat(java.lang.String dateFormat)` Set the date format to use for translating string attributes.
`void` | `setFrom(java.lang.String startDateString)` Set the from date as a String.
`void` | `setOn(java.lang.String on)` Set the on date as a string.
`void` | `setTo(java.lang.String endDateString)` Set the end date 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`

Field Detail

### DEFAULT_DATE_FORMAT

    public static final java.lang.String DEFAULT_DATE_FORMAT

See Also:
  Constant Field Values

Constructor Detail

### DateSchedule

    public DateSchedule()

Method Detail

### setFormat

    public void setFormat(java.lang.String dateFormat)

  Set the date format to use for translating string attributes.

  Parameters:
    `dateFormat` - The date format.

### getFormat

    public java.lang.String getFormat()

  Get the date format used for translating string attributes.

  Returns:
    The date format being used.

### setFrom

    public void setFrom(java.lang.String startDateString)
                 throws java.text.ParseException

  Set the from date as a String.

  Parameters:
    `startDateString` - The from date. May be null which indicates the beginning of the time.
  Throws:
    `java.text.ParseException` - If the String isn't a Date.

### getFrom

    public java.lang.String getFrom()

  Get the from Date as a String.

  Returns:
    The from date. May be null.

### setTo

    public void setTo(java.lang.String endDateString)
               throws java.text.ParseException

  Set the end date as a String.

  Parameters:
    `endDateString` - The end date. May be null.
  Throws:
    `java.text.ParseException` - If the string isn't a valid date.

### getTo

    public java.lang.String getTo()

  Return the to date as a string.

  Returns:
    The to date, may be null.

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

### getStartDate

    public java.util.Date getStartDate(java.util.Date now)

  Return the start date.

  Returns:
    The start date.

### getEndDate

    public java.util.Date getEndDate(java.util.Date now)

  Return the end date.

  Returns:
    The end 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.

  Specified by:
    `nextDue` in interface `Schedule`
  Parameters:
    `now` - The date now.
  Returns:
    The next due interval for the schedule.

### toString

    public java.lang.String toString()

  Override toString.

Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD