Package net.fortuna.ical4j.model
Class Recur<T extends Temporal>
- java.lang.Object
-
- net.fortuna.ical4j.model.Recur<T>
-
- All Implemented Interfaces:
Serializable
public class Recur<T extends Temporal> extends Object implements Serializable
$Id$ [18-Apr-2004]3.3.10. Recurrence Rule Value Name: RECUR Purpose: This value type is used to identify properties that contain a recurrence rule specification. Format Definition: This value type is defined by the following notation: recur = recur-rule-part *( ";" recur-rule-part ) ; ; The rule parts are not ordered in any ; particular sequence. ; ; The FREQ rule part is REQUIRED, ; but MUST NOT occur more than once. ; ; The UNTIL or COUNT rule parts are OPTIONAL, ; but they MUST NOT occur in the same 'recur'. ; ; The other rule parts are OPTIONAL, ; but MUST NOT occur more than once. recur-rule-part = ( "FREQ" "=" freq ) / ( "UNTIL" "=" enddate ) / ( "COUNT" "=" 1*DIGIT ) / ( "INTERVAL" "=" 1*DIGIT ) / ( "BYSECOND" "=" byseclist ) / ( "BYMINUTE" "=" byminlist ) / ( "BYHOUR" "=" byhrlist ) / ( "BYDAY" "=" bywdaylist ) / ( "BYMONTHDAY" "=" bymodaylist ) / ( "BYYEARDAY" "=" byyrdaylist ) / ( "BYWEEKNO" "=" bywknolist ) / ( "BYMONTH" "=" bymolist ) / ( "BYSETPOS" "=" bysplist ) / ( "WKST" "=" weekday ) freq = "SECONDLY" / "MINUTELY" / "HOURLY" / "DAILY" / "WEEKLY" / "MONTHLY" / "YEARLY" enddate = date / date-time byseclist = ( seconds *("," seconds) ) seconds = 1*2DIGIT ;0 to 60 byminlist = ( minutes *("," minutes) ) minutes = 1*2DIGIT ;0 to 59 byhrlist = ( hour *("," hour) ) hour = 1*2DIGIT ;0 to 23 bywdaylist = ( weekdaynum *("," weekdaynum) ) weekdaynum = [[plus / minus] ordwk] weekday plus = "+" minus = "-" ordwk = 1*2DIGIT ;1 to 53 weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA" ;Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, ;FRIDAY, and SATURDAY days of the week. bymodaylist = ( monthdaynum *("," monthdaynum) ) monthdaynum = [plus / minus] ordmoday ordmoday = 1*2DIGIT ;1 to 31 byyrdaylist = ( yeardaynum *("," yeardaynum) ) yeardaynum = [plus / minus] ordyrday ordyrday = 1*3DIGIT ;1 to 366 bywknolist = ( weeknum *("," weeknum) ) weeknum = [plus / minus] ordwk bymolist = ( monthnum *("," monthnum) ) monthnum = 1*2DIGIT ;1 to 12 bysplist = ( setposday *("," setposday) ) setposday = yeardaynum
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Recur.Builder<T extends Temporal>
Support for building Recur instances.static class
Recur.RScale
static class
Recur.Skip
-
Field Summary
Fields Modifier and Type Field Description static String
DAILY
Deprecated.useFrequency
instead.static String
HOURLY
Deprecated.useFrequency
instead.static String
KEY_MAX_INCREMENT_COUNT
When calculating dates matching this recur (getDates()
orgetNextDate
), this property defines the maximum number of attempt to find a matching date by incrementing the seed.static String
MINUTELY
Deprecated.useFrequency
instead.static String
MONTHLY
Deprecated.useFrequency
instead.static String
SECONDLY
Deprecated.useFrequency
instead.static String
WEEKLY
Deprecated.useFrequency
instead.static String
YEARLY
Deprecated.useFrequency
instead.
-
Constructor Summary
Constructors Constructor Description Recur(String aValue)
Constructs a new instance from the specified string value.Recur(String aValue, boolean experimentalTokensAllowed)
Constructs a new recurrence from the specified string value.Recur(String frequency, int count)
Deprecated.Recur(String frequency, T until)
Deprecated.Recur(Frequency frequency, int count)
Recur(Frequency frequency, T until)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getCount()
List<T>
getDates(T seed, Period<T> period)
Convenience method for retrieving recurrences in a specified period.List<T>
getDates(T periodStart, T periodEnd)
Returns a list of start dates in the specified period represented by this recur.List<T>
getDates(T seed, T periodStart, T periodEnd)
Returns a list of start dates in the specified period represented by this recur.List<T>
getDates(T seed, T periodStart, T periodEnd, int maxCount)
Returns a list of start dates in the specified period represented by this recur.List<WeekDay>
getDayList()
Accessor for the configured BYDAY list.Map<String,String>
getExperimentalValues()
Frequency
getFrequency()
List<Integer>
getHourList()
Accessor for the configured BYHOUR list.int
getInterval()
List<Integer>
getMinuteList()
Accessor for the configured BYMINUTE list.List<Integer>
getMonthDayList()
Accessor for the configured BYMONTHDAY list.List<Month>
getMonthList()
Accessor for the configured BYMONTH list.T
getNextDate(T seed, T startDate)
Returns the the next date of this recurrence given a seed date and start date.List<Integer>
getSecondList()
Accessor for the configured BYSECOND list.List<Integer>
getSetPosList()
Accessor for the configured BYSETPOS list.Recur.Skip
getSkip()
T
getUntil()
List<Integer>
getWeekNoList()
Accessor for the configured BYWEEKNO list.WeekDay
getWeekStartDay()
List<Integer>
getYearDayList()
Accessor for the configured BYYEARDAY list.void
setCount(int count)
Deprecated.will be removed in a future version to support immutable pattern.void
setFrequency(String frequency)
Deprecated.will be removed in a future version to support immutable pattern.void
setInterval(int interval)
Deprecated.will be removed in a future version to support immutable pattern.void
setUntil(T until)
Deprecated.will be removed in a future version to support immutable pattern.void
setWeekStartDay(WeekDay weekStartDay)
Deprecated.will be removed in a future version to support immutable pattern.String
toString()
-
-
-
Field Detail
-
SECONDLY
@Deprecated public static final String SECONDLY
Deprecated.useFrequency
instead.Second frequency resolution.- See Also:
- Constant Field Values
-
MINUTELY
@Deprecated public static final String MINUTELY
Deprecated.useFrequency
instead.Minute frequency resolution.- See Also:
- Constant Field Values
-
HOURLY
@Deprecated public static final String HOURLY
Deprecated.useFrequency
instead.Hour frequency resolution.- See Also:
- Constant Field Values
-
DAILY
@Deprecated public static final String DAILY
Deprecated.useFrequency
instead.Day frequency resolution.- See Also:
- Constant Field Values
-
WEEKLY
@Deprecated public static final String WEEKLY
Deprecated.useFrequency
instead.Week frequency resolution.- See Also:
- Constant Field Values
-
MONTHLY
@Deprecated public static final String MONTHLY
Deprecated.useFrequency
instead.Month frequency resolution.- See Also:
- Constant Field Values
-
YEARLY
@Deprecated public static final String YEARLY
Deprecated.useFrequency
instead.Year frequency resolution.- See Also:
- Constant Field Values
-
KEY_MAX_INCREMENT_COUNT
public static final String KEY_MAX_INCREMENT_COUNT
When calculating dates matching this recur (getDates()
orgetNextDate
), this property defines the maximum number of attempt to find a matching date by incrementing the seed.The default value is 1000. A value of -1 corresponds to no maximum.
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Recur
public Recur(String aValue)
Constructs a new instance from the specified string value.- Parameters:
aValue
- a string representation of a recurrence.
-
Recur
public Recur(String aValue, boolean experimentalTokensAllowed)
Constructs a new recurrence from the specified string value.- Parameters:
aValue
- a string representation of a recurrence.experimentalTokensAllowed
- allow unrecognised tokens in the recurrence
-
Recur
@Deprecated public Recur(String frequency, T until)
Deprecated.- Parameters:
frequency
- a recurrence frequency stringuntil
- maximum recurrence date
-
Recur
public Recur(Frequency frequency, T until)
- Parameters:
frequency
- a recurrence frequency stringuntil
- maximum recurrence date
-
Recur
@Deprecated public Recur(String frequency, int count)
Deprecated.- Parameters:
frequency
- a recurrence frequency stringcount
- maximum recurrence count
-
Recur
public Recur(Frequency frequency, int count)
- Parameters:
frequency
- a recurrence frequency stringcount
- maximum recurrence count
-
-
Method Detail
-
getDayList
public final List<WeekDay> getDayList()
Accessor for the configured BYDAY list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the dayList.
-
getHourList
public final List<Integer> getHourList()
Accessor for the configured BYHOUR list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the hourList.
-
getMinuteList
public final List<Integer> getMinuteList()
Accessor for the configured BYMINUTE list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the minuteList.
-
getMonthDayList
public final List<Integer> getMonthDayList()
Accessor for the configured BYMONTHDAY list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the monthDayList.
-
getMonthList
public final List<Month> getMonthList()
Accessor for the configured BYMONTH list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the monthList.
-
getSecondList
public final List<Integer> getSecondList()
Accessor for the configured BYSECOND list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the secondList.
-
getSetPosList
public final List<Integer> getSetPosList()
Accessor for the configured BYSETPOS list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the setPosList.
-
getWeekNoList
public final List<Integer> getWeekNoList()
Accessor for the configured BYWEEKNO list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the weekNoList.
-
getYearDayList
public final List<Integer> getYearDayList()
Accessor for the configured BYYEARDAY list. NOTE: Any changes to the returned list will have no effect on the recurrence rule processing.- Returns:
- Returns the yearDayList.
-
getCount
public final int getCount()
- Returns:
- Returns the count or -1 if the rule does not have a count.
-
getExperimentalValues
public final Map<String,String> getExperimentalValues()
- Returns:
- Returns the experimentalValues.
-
getFrequency
public final Frequency getFrequency()
- Returns:
- Returns the frequency.
-
getSkip
public Recur.Skip getSkip()
- Returns:
- leap month skip behaviour.
-
getInterval
public final int getInterval()
- Returns:
- Returns the interval or -1 if the rule does not have an interval defined.
-
getUntil
public final T getUntil()
- Returns:
- Returns the until or null if there is none.
-
getWeekStartDay
public final WeekDay getWeekStartDay()
- Returns:
- Returns the weekStartDay or null if there is none.
-
setWeekStartDay
@Deprecated public final void setWeekStartDay(WeekDay weekStartDay)
Deprecated.will be removed in a future version to support immutable pattern.- Parameters:
weekStartDay
- The weekStartDay to set.
-
getDates
public final List<T> getDates(T periodStart, T periodEnd)
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 periodperiodEnd
- the end of the period- Returns:
- a list of dates
-
getDates
public final List<T> getDates(T seed, Period<T> period)
Convenience method for retrieving recurrences in a specified period.- Parameters:
seed
- a seed date for generating recurrence instancesperiod
- the period of returned recurrence dates- Returns:
- a list of dates
-
getDates
public final List<T> getDates(T seed, T periodStart, T periodEnd)
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 instanceperiodStart
- the start of the periodperiodEnd
- the end of the period- Returns:
- a list of dates represented by this recur instance
-
getDates
public final List<T> getDates(T seed, T periodStart, T periodEnd, 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 instanceperiodStart
- the start of the periodperiodEnd
- the end of the periodmaxCount
- 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
-
getNextDate
public final T getNextDate(T seed, T 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 instancestartDate
- the date to start the search- Returns:
- the next date in the recurrence series after startDate
-
setCount
@Deprecated public final void setCount(int count)
Deprecated.will be removed in a future version to support immutable pattern.- Parameters:
count
- The count to set.
-
setFrequency
@Deprecated public final void setFrequency(String frequency)
Deprecated.will be removed in a future version to support immutable pattern.- Parameters:
frequency
- The frequency to set.
-
setInterval
@Deprecated public final void setInterval(int interval)
Deprecated.will be removed in a future version to support immutable pattern.- Parameters:
interval
- The interval to set.
-
setUntil
@Deprecated public final void setUntil(T until)
Deprecated.will be removed in a future version to support immutable pattern.- Parameters:
until
- The until to set.
-
-