net.fortuna.ical4j.model

Class Recur

Implemented Interfaces:
Serializable

public class Recur
extends java.lang.Object
implements Serializable

$Id: Recur.java,v 1.44 2009/01/06 08:14:50 fortuna Exp $ [18-Apr-2004] Defines a recurrence.

Field Summary

static String
DAILY
static String
HOURLY
static String
MINUTELY
static String
MONTHLY
static String
SECONDLY
static String
WEEKLY
static String
YEARLY

Constructor Summary

Recur(String aValue)
Constructs a new instance from the specified string value.
Recur(String frequency, Date until)
Recur(String frequency, int count)

Method Summary

int
getCount()
DateList
getDates(Date seed, Date periodStart, Date periodEnd, Value value)
Returns a list of start dates in the specified period represented by this recur.
DateList
getDates(Date seed, Date periodStart, Date periodEnd, Value value, int maxCount)
Returns a list of start dates in the specified period represented by this recur.
DateList
getDates(Date periodStart, Date periodEnd, Value value)
Returns a list of start dates in the specified period represented by this recur.
DateList
getDates(Date seed, Period period, Value value)
Convenience method for retrieving recurrences in a specified period.
WeekDayList
getDayList()
Map
getExperimentalValues()
String
getFrequency()
NumberList
getHourList()
int
getInterval()
NumberList
getMinuteList()
NumberList
getMonthDayList()
NumberList
getMonthList()
Date
getNextDate(Date seed, Date startDate)
Returns the the next date of this recurrence given a seed date and start date.
NumberList
getSecondList()
NumberList
getSetPosList()
Date
getUntil()
NumberList
getWeekNoList()
String
getWeekStartDay()
NumberList
getYearDayList()
void
setCount(int count)
void
setFrequency(String frequency)
void
setInterval(int interval)
void
setUntil(Date until)
void
setWeekStartDay(String weekStartDay)
String
toString()

Field Details

DAILY

public static final String DAILY

HOURLY

public static final String HOURLY

MINUTELY

public static final String MINUTELY

MONTHLY

public static final String MONTHLY

SECONDLY

public static final String SECONDLY

WEEKLY

public static final String WEEKLY

YEARLY

public static final String YEARLY

Constructor Details

Recur

public Recur(String aValue)
            throws ParseException
Constructs a new instance from the specified string value.
Parameters:
aValue - a string representation of a recurrence.

Recur

public Recur(String frequency,
             Date until)
Parameters:
frequency -
until -

Recur

public Recur(String frequency,
             int count)
Parameters:
frequency -
count -

Method Details

getCount

public final int getCount()
Returns:
Returns the count.

getDates

public final DateList getDates(Date seed,
                               Date periodStart,
                               Date periodEnd,
                               Value value)
Returns a list of start dates in the specified period represented by this recur. This method includes a base date argument, which indicates the start of the fist occurrence of this recurrence. The base date is used to inject default values to return a set of dates in the correct format. For example, if the search start date (start) is Wed, Mar 23, 12:19PM, but the recurrence is Mon - Fri, 9:00AM - 5:00PM, the start dates returned should all be at 9:00AM, and not 12:19PM.
Parameters:
seed - the start date of this Recurrence's first instance
periodStart - the start of the period
periodEnd - the end of the period
value - the type of dates to generate (i.e. date/date-time)
Returns:
a list of dates represented by this recur instance

getDates

public final DateList getDates(Date seed,
                               Date periodStart,
                               Date periodEnd,
                               Value value,
                               int maxCount)
Returns a list of start dates in the specified period represented by this recur. This method includes a base date argument, which indicates the start of the fist occurrence of this recurrence. The base date is used to inject default values to return a set of dates in the correct format. For example, if the search start date (start) is Wed, Mar 23, 12:19PM, but the recurrence is Mon - Fri, 9:00AM - 5:00PM, the start dates returned should all be at 9:00AM, and not 12:19PM.
Parameters:
seed - the start date of this Recurrence's first instance
periodStart - the start of the period
periodEnd - the end of the period
value - the type of dates to generate (i.e. date/date-time)
maxCount - limits the number of instances returned. Up to one years worth extra may be returned. Less than 0 means no limit
Returns:
a list of dates represented by this recur instance

getDates

public final DateList getDates(Date periodStart,
                               Date periodEnd,
                               Value value)
Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by this recur are retained from the period start, and as such you should ensure the period start is initialised correctly.
Parameters:
periodStart - the start of the period
periodEnd - the end of the period
value - the type of dates to generate (i.e. date/date-time)
Returns:
a list of dates

getDates

public final DateList getDates(Date seed,
                               Period period,
                               Value value)
Convenience method for retrieving recurrences in a specified period.
Parameters:
period - the period of returned recurrence dates
value - type of dates to generate
Returns:
a list of dates

getDayList

public final WeekDayList getDayList()
Returns:
Returns the dayList.

getExperimentalValues

public final Map getExperimentalValues()
Returns:
Returns the experimentalValues.

getFrequency

public final String getFrequency()
Returns:
Returns the frequency.

getHourList

public final NumberList getHourList()
Returns:
Returns the hourList.

getInterval

public final int getInterval()
Returns:
Returns the interval.

getMinuteList

public final NumberList getMinuteList()
Returns:
Returns the minuteList.

getMonthDayList

public final NumberList getMonthDayList()
Returns:
Returns the monthDayList.

getMonthList

public final NumberList getMonthList()
Returns:
Returns the monthList.

getNextDate

public final Date getNextDate(Date seed,
                              Date startDate)
Returns the the next date of this recurrence given a seed date and start date. The seed date indicates the start of the fist occurrence of this recurrence. The start date is the starting date to search for the next recurrence. Return null if there is no occurrence date after start date.
Parameters:
seed - the start date of this Recurrence's first instance
startDate - the date to start the search
Returns:
the next date in the recurrence series after startDate

getSecondList

public final NumberList getSecondList()
Returns:
Returns the secondList.

getSetPosList

public final NumberList getSetPosList()
Returns:
Returns the setPosList.

getUntil

public final Date getUntil()
Returns:
Returns the until.

getWeekNoList

public final NumberList getWeekNoList()
Returns:
Returns the weekNoList.

getWeekStartDay

public final String getWeekStartDay()
Returns:
Returns the weekStartDay.

getYearDayList

public final NumberList getYearDayList()
Returns:
Returns the yearDayList.

setCount

public final void setCount(int count)
Parameters:
count - The count to set.

setFrequency

public final void setFrequency(String frequency)
Parameters:
frequency - The frequency to set.

setInterval

public final void setInterval(int interval)
Parameters:
interval - The interval to set.

setUntil

public final void setUntil(Date until)
Parameters:
until - The until to set.

setWeekStartDay

public final void setWeekStartDay(String weekStartDay)
Parameters:
weekStartDay - The weekStartDay to set.

toString

public final String toString()
See Also:
java.lang.Object.toString()