Packageardisia.scheduling.iCalendarRecurrence
Classpublic class iCalendarRecurrence
InheritanceiCalendarRecurrence Inheritance Object

Generates and returns an array of Date objects created by the provided SchedulingData object's recurrence properties. Follows the iCalendar spec, located at http://tools.ietf.org/html/rfc5545.

If the SchedulingData has infinite recurrence, and "count" or "until" is not set, the default short-circuit is 2 years after dtStart. See the "defaultUntil" property.

Purely static class.

See the SchedulingData docs for explanations on the pertinent recurrence properties.

+----------+--------+--------+-------+-------+------+-------+------+ | |SECONDLY|MINUTELY|HOURLY |DAILY |WEEKLY|MONTHLY|YEARLY| +----------+--------+--------+-------+-------+------+-------+------+ |BYMONTH |Limit |Limit |Limit |Limit |Limit |Limit |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYWEEKNO |N/A |N/A |N/A |N/A |N/A |N/A |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYYEARDAY |Limit |Limit |Limit |N/A |N/A |N/A |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYMONTHDAY|Limit |Limit |Limit |Limit |N/A |Expand |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYDAY |Limit |Limit |Limit |Limit |Expand|Note 1 |Note 2| +----------+--------+--------+-------+-------+------+-------+------+ |BYHOUR |Limit |Limit |Limit |Expand |Expand|Expand |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYMINUTE |Limit |Limit |Expand |Expand |Expand|Expand |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYSECOND |Limit |Expand |Expand |Expand |Expand|Expand |Expand| +----------+--------+--------+-------+-------+------+-------+------+ |BYSETPOS |Limit |Limit |Limit |Limit |Limit |Limit |Limit | +----------+--------+--------+-------+-------+------+-------+------+ Note 1: Limit if BYMONTHDAY is present; otherwise, special expand for MONTHLY. Note 2: Limit if BYYEARDAY or BYMONTHDAY is present; otherwise, special expand for WEEKLY if BYWEEKNO present; otherwise, special expand for MONTHLY if BYMONTH present; otherwise, special expand for YEARLY.



Public Properties
 PropertyDefined By
  defaultUntil : Date
[static] Sets the "until" property if not set in the SchedulingData object.
iCalendarRecurrence
Public Methods
 MethodDefined By
  
generateRecurrenceDates(calendarData:SchedulingData, startDt:Date = null):Array
[static] Returns an array of Date objects for all the dates created by the recurrence rules for the provided SchedulingData object.
iCalendarRecurrence
Protected Methods
 MethodDefined By
  
byDayFilter(dt:Date):Boolean
[static] Filters dates based on the "byDay" property.
iCalendarRecurrence
  
byDayGenerator(yearlyInterval:int = 1, monthlyInterval:int = 1, weeklyInterval:int = 1):void
[static] Generates dates based on the "byDay" property.
iCalendarRecurrence
  
byMonthDayFilter(dt:Date):Boolean
[static] Filters dates based on the "byMonthDay" property.
iCalendarRecurrence
  
byMonthDayGenerator(yearlyInterval:int = 1, monthlyInterval:int = 1):void
[static] Generates dates based on the "byMonthDay" property.
iCalendarRecurrence
  
byMonthFilter(dt:Date):Boolean
[static] Filters dates based on the "byMonth" property.
iCalendarRecurrence
  
byMonthGenerator(yearlyInterval:int):void
[static] Generates dates based on the "byMonth" property.
iCalendarRecurrence
  
bySetPosFilter(intervalDates:Array):Boolean
[static] Filters dates based on the "bySetPos" property.
iCalendarRecurrence
  
byWeekNoFilter(dt:Date):Boolean
[static] Filters dates based on the "byWeekNo" property.
iCalendarRecurrence
  
byWeekNoGenerator(yearlyInterval:int = 1):void
[static] Generates dates based on the "byWeekNo" property.
iCalendarRecurrence
  
byYearDayFilter(dt:Date):Boolean
[static] Filters dates based on the "byYearDay" property.
iCalendarRecurrence
  
byYearDayGenerator(yearlyInterval:int):void
[static] Generates dates based on the "byYearDay" property.
iCalendarRecurrence
  
checkForShortCircuit(dt:Date):Boolean
[static] Checks if the generators should short circuit and quit.
iCalendarRecurrence
  
[static] Filters dates based on the "exDate" property.
iCalendarRecurrence
  
[static] Generates dates using the "rDate" property.
iCalendarRecurrence
  
runFilters(dt:Date):Boolean
[static] Runs the flagged filters and returns whether the date was filtered out of the recurrence set.
iCalendarRecurrence
  
serialDayGenerator(interval:int):void
[static] Simple serial generator that creates dates in day intervals.
iCalendarRecurrence
  
serialMonthGenerator(interval:int):void
[static] Simple serial generator that creates dates in month intervals.
iCalendarRecurrence
  
serialWeekGenerator(interval:int):void
[static] Simple serial generator that creates dates in week intervals.
iCalendarRecurrence
  
serialYearGenerator(interval:int):void
[static] Simple serial generator that creates dates in year intervals.
iCalendarRecurrence
Property Detail
defaultUntilproperty
public static var defaultUntil:Date

Sets the "until" property if not set in the SchedulingData object.

Useful to avoid infinite recurrence items creating infinite loops.

If this property is not set, and the data does not define "until" or "count", the default short circuit is 2 years after dtStart.

The default value is undefined.

Method Detail
byDayFilter()method
protected static function byDayFilter(dt:Date):Boolean

Filters dates based on the "byDay" property.

Parameters

dt:Date — the Date to check if was filtered

Returns
Boolean
byDayGenerator()method 
protected static function byDayGenerator(yearlyInterval:int = 1, monthlyInterval:int = 1, weeklyInterval:int = 1):void

Generates dates based on the "byDay" property.

The most complex rule, because it must be able to accommodate every frequency.

Note: the weekly frequency requires a different implementation and if the interval is greater than 1, wkst is required and relevant.

The position integer can refer to the month or year depending on the recurrence properties. For yearly, the integer is the year position unless byMonth is set, in which case the integer is monthly.

Parameters

yearlyInterval:int (default = 1)
 
monthlyInterval:int (default = 1)
 
weeklyInterval:int (default = 1)

byMonthDayFilter()method 
protected static function byMonthDayFilter(dt:Date):Boolean

Filters dates based on the "byMonthDay" property.

Parameters

dt:Date — the Date to check if was filtered

Returns
Boolean
byMonthDayGenerator()method 
protected static function byMonthDayGenerator(yearlyInterval:int = 1, monthlyInterval:int = 1):void

Generates dates based on the "byMonthDay" property.

Daily interval is ignored.

Since byMonthDay can be expressed as positive or negative integers, there is a possibility of redundant dates. Convert byMonthDay to a set of positive integers before looping to ensure uniqueness and that the array is in numerical order.

Parameters

yearlyInterval:int (default = 1)
 
monthlyInterval:int (default = 1)

byMonthFilter()method 
protected static function byMonthFilter(dt:Date):Boolean

Filters dates based on the "byMonth" property.

Parameters

dt:Date — the Date to check if was filtered

Returns
Boolean
byMonthGenerator()method 
protected static function byMonthGenerator(yearlyInterval:int):void

Generates dates based on the "byMonth" property.

This generator is only used with "yearly" frequency.

Parameters

yearlyInterval:int

bySetPosFilter()method 
protected static function bySetPosFilter(intervalDates:Array):Boolean

Filters dates based on the "bySetPos" property.

Parameters

intervalDates:Array — the Date to check if was filtered

Returns
Boolean — Boolean
byWeekNoFilter()method 
protected static function byWeekNoFilter(dt:Date):Boolean

Filters dates based on the "byWeekNo" property.

The iCalendar spec defines the first week in the year to be the first week with 4 days in the specified year.

Parameters

dt:Date — the Date to check if was filtered

Returns
Boolean
byWeekNoGenerator()method 
protected static function byWeekNoGenerator(yearlyInterval:int = 1):void

Generates dates based on the "byWeekNo" property.

The iCalendar spec is unclear on how byWeekNo is handled when no other criteria are provided.

Does it repeat the month day number or the day of the week? I am choosing to repeat the day of the week. E.G., if dtStart is Sunday, Jan 1 and byWeekNo is 10, then find the Sunday in the 10th week.

Parameters

yearlyInterval:int (default = 1) — Interval

byYearDayFilter()method 
protected static function byYearDayFilter(dt:Date):Boolean

Filters dates based on the "byYearDay" property.

Parameters

dt:Date — the Date to check if was filtered

Returns
Boolean
byYearDayGenerator()method 
protected static function byYearDayGenerator(yearlyInterval:int):void

Generates dates based on the "byYearDay" property.

Parameters

yearlyInterval:int

checkForShortCircuit()method 
protected static function checkForShortCircuit(dt:Date):Boolean

Checks if the generators should short circuit and quit.

Parameters

dt:Date — the date to check

Returns
Boolean
exDateFilter()method 
protected static function exDateFilter():void

Filters dates based on the "exDate" property.

generateRecurrenceDates()method 
public static function generateRecurrenceDates(calendarData:SchedulingData, startDt:Date = null):Array

Returns an array of Date objects for all the dates created by the recurrence rules for the provided SchedulingData object.

Add the optional startDt to generate from that Date, rather than the dtStart property of the provided SchedulingData object. The optional parameter Date will not be returned in the results array.

Custom start dates are useful to get segments of a infinite recurrence loop.

Parameters

calendarData:SchedulingData — A SchedulingData object with recurrence
 
startDt:Date (default = null) — The start date to begin calculating recurrence

Returns
Array — Array of Date objects
rDateGenerator()method 
protected static function rDateGenerator():void

Generates dates using the "rDate" property.

runFilters()method 
protected static function runFilters(dt:Date):Boolean

Runs the flagged filters and returns whether the date was filtered out of the recurrence set.

Parameters

dt:Date — The Date object to check if filtered

Returns
Boolean — a Boolean whether the date was filtered out or not
serialDayGenerator()method 
protected static function serialDayGenerator(interval:int):void

Simple serial generator that creates dates in day intervals.

Parameters

interval:int — the number of days between each Date in the set

serialMonthGenerator()method 
protected static function serialMonthGenerator(interval:int):void

Simple serial generator that creates dates in month intervals.

Parameters

interval:int — the number of months between each Date in the set

serialWeekGenerator()method 
protected static function serialWeekGenerator(interval:int):void

Simple serial generator that creates dates in week intervals.

Parameters

interval:int — the number of weeks between each Date in the set

serialYearGenerator()method 
protected static function serialYearGenerator(interval:int):void

Simple serial generator that creates dates in year intervals.

Parameters

interval:int — the number of years between each Date in the set