com.funambol.common.pim.model.calendar
Class RecurrencePattern

java.lang.Object
  extended by com.funambol.common.pim.model.common.Property
      extended by com.funambol.common.pim.model.common.PropertyWithTimeZone
          extended by com.funambol.common.pim.model.calendar.RecurrencePattern

public class RecurrencePattern
extends PropertyWithTimeZone

This class represents the recurrence pattern of a calendar item.

Version:
$Id: RecurrencePattern.java,v 1.7 2008-06-24 12:01:27 mauro Exp $

Field Summary
static short ALL_DAYS_MASK
           
static byte DAY_OF_WEEK_FRIDAY
           
static byte DAY_OF_WEEK_MONDAY
           
static byte DAY_OF_WEEK_SATURDAY
           
static byte DAY_OF_WEEK_SUNDAY
           
static byte DAY_OF_WEEK_THURSDAY
           
static byte DAY_OF_WEEK_TUESDAY
           
static byte DAY_OF_WEEK_WEDNESDAY
           
static byte TYPE_DAILY
           
static byte TYPE_DAYLY
           
static byte TYPE_MONTH_NTH
           
static byte TYPE_MONTHLY
           
static byte TYPE_WEEKLY
           
static byte TYPE_YEAR_NTH
           
static byte TYPE_YEARLY
           
static short UNSPECIFIED
           
 
Fields inherited from class com.funambol.common.pim.model.common.PropertyWithTimeZone
timeZone
 
Fields inherited from class com.funambol.common.pim.model.common.Property
altrep, chrset, cn, cutype, delegatedFrom, delegatedTo, dir, encoding, group, language, member, partstat, propertyValue, related, sentby, tag, type, value, xParams
 
Constructor Summary
RecurrencePattern(short type, int interval, short monthOfYear, short dayOfMonth, short dayOfWeekMask, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Creates a new instance of RecurrencePattern.
RecurrencePattern(short type, int interval, short monthOfYear, short dayOfMonth, short dayOfWeekMask, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Creates a new instance of RecurrencePattern.
 
Method Summary
 boolean fix()
          Fixes missing data on the basis of the startDatePattern field, according to the inference rules prescribed by the specifications (missing data must be inferred by the start date).
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern)
          Infinite daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, boolean noEndDate)
          Infinite daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, boolean noEndDate, int occurrences)
          Daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, boolean noEndDate, int occurrences, short dayOfWeekMask)
          Daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, boolean noEndDate, short dayOfWeekMask)
          Infinite daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, short dayOfWeekMask)
          Inifinite daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Daily recurrence with start and end dates.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Daily recurrence with start, end dates and noEndDate.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Daily recurrence
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences, short dayOfWeekMask)
          Daily recurrence.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, short dayOfWeekMask)
          Daily recurrence with start, end dates and noEndDate.
static RecurrencePattern getDailyRecurrencePattern(int interval, java.lang.String startDatePattern, java.lang.String endDatePattern, short dayOfWeekMask)
          Daily recurrence with start and end dates.
 short getDayOfMonth()
          Returns the day of the month.
 java.util.List<java.lang.String> getDayOfWeek()
          Return a list of abbreviations of days of week in which the task or event recurs.
 short getDayOfWeekMask()
          Returns the day-of-week mask.
 java.lang.String getEndDatePattern()
          Returns the end date pattern.
 java.util.List<ExceptionToRecurrenceRule> getExceptions()
          Gets the exception list, duplicate-free and ordered.
 short getInstance()
          Returns the instance number.
 int getInterval()
          Returns the interval.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern)
          Infinite monthly recurrence.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern, boolean noEndDate)
          Infinite monthly recurrence.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern, boolean noEndDate, int occurrences)
          Monthly recurrence.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Monthly recurrence with start and end dates.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Monthly recurrence with start, end dates and noEndDate.
static RecurrencePattern getMonthlyRecurrencePattern(int interval, short dayOfMonth, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Monthly recurrence.
static RecurrencePattern getMonthNthRecurrencePattern(int interval, short dayOfWeekMask, short instance, java.lang.String startDatePattern)
          Monthly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getMonthNthRecurrencePattern(int interval, short dayOfWeekMask, short instance, java.lang.String startDatePattern, boolean noEndDate)
          Monthly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getMonthNthRecurrencePattern(int interval, short dayOfWeekMask, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Monthly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getMonthNthRecurrencePattern(int interval, short dayOfWeekMask, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Monthly day-of-week-based recurrence with start, end dates and noEndDate.
 short getMonthOfYear()
          Returns the month of year.
 int getOccurrences()
          Returns the number of occurrences.
 java.lang.String getStartDatePattern()
          Returns the start date pattern.
 java.lang.String getTypeDesc()
          Gives a vCalendar short form for the recurrence frequency.
 short getTypeId()
          Returns the recurrence frequency as a number.
static RecurrencePattern getWeeklyRecurrencePattern(int interval, short dayOfWeekMask, java.lang.String startDatePattern)
          Infinite weekly recurrence
static RecurrencePattern getWeeklyRecurrencePattern(int interval, short dayOfWeekMask, java.lang.String startDatePattern, boolean noEndDate)
          Infinite weekly recurrence
static RecurrencePattern getWeeklyRecurrencePattern(int interval, short dayOfWeekMask, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Weekly recurrence with start and end dates.
static RecurrencePattern getWeeklyRecurrencePattern(int interval, short dayOfWeekMask, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Weekly recurrence with start, end dates and noEndDate.
static RecurrencePattern getWeeklyRecurrencePattern(int interval, short dayOfWeekMask, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Weekly recurrence.
static RecurrencePattern getYearlyRecurrencePattern(int interval, short dayOfMonth, short monthOfYear, java.lang.String startDatePattern)
          Infinite yearly recurrence.
static RecurrencePattern getYearlyRecurrencePattern(int interval, short dayOfMonth, short monthOfYear, java.lang.String startDatePattern, boolean noEndDate)
          Infinite yearly recurrence.
static RecurrencePattern getYearlyRecurrencePattern(int interval, short dayOfMonth, short monthOfYear, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Yearly recurrence with start, end dates and noEndDate
static RecurrencePattern getYearlyRecurrencePattern(int interval, short dayOfMonth, short monthOfYear, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Yearly recurrence with start, end dates and noEndDate.
static RecurrencePattern getYearlyRecurrencePattern(int interval, short dayOfMonth, short monthOfYear, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Yearly recurrence.
static RecurrencePattern getYearNthRecurrencePattern(int interval, short dayOfWeekMask, short monthOfYear, short instance, java.lang.String startDatePattern)
          Yearly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getYearNthRecurrencePattern(int interval, short dayOfWeekMask, short monthOfYear, short instance, java.lang.String startDatePattern, boolean noEndDate)
          Yearly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getYearNthRecurrencePattern(int interval, short dayOfWeekMask, short monthOfYear, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern)
          Yearly day-of-week-based recurrence with start and end dates.
static RecurrencePattern getYearNthRecurrencePattern(int interval, short dayOfWeekMask, short monthOfYear, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate)
          Yearly day-of-week-based recurrence with start, end dates and noEndDate.
static RecurrencePattern getYearNthRecurrencePattern(int interval, short dayOfWeekMask, short monthOfYear, short instance, java.lang.String startDatePattern, java.lang.String endDatePattern, boolean noEndDate, int occurrences)
          Yearly day-of-week-based recurrence.
 boolean isNoEndDate()
          Returns whether the pattern has no end date set.
 void setExceptions(java.util.List<ExceptionToRecurrenceRule> exceptions)
          Sets the exception list.
 void setExceptions(java.util.SortedSet<ExceptionToRecurrenceRule> exceptions)
          Sets the exception set.
 void setNoEndDate(boolean noEndDate)
          Setter for property noEndDate.
 void setOccurrences(int occurrences)
          Setter for property occurrences.
 java.lang.String toString()
           
 
Methods inherited from class com.funambol.common.pim.model.common.PropertyWithTimeZone
getTimeZone, setTimeZone
 
Methods inherited from class com.funambol.common.pim.model.common.Property
compare, equals, getAltrep, getCharset, getCn, getCutype, getDelegatedFrom, getDelegatedTo, getDir, getEncoding, getGroup, getLanguage, getMember, getPartstat, getPropertyValue, getPropertyValueAsString, getRelated, getSentby, getTag, getType, getValue, getXParams, hashCode, isEmptyProperty, setAltrep, setCharset, setCn, setCutype, setDelegatedFrom, setDelegatedTo, setDir, setEncoding, setGroup, setLanguage, setMember, setPartstat, setPropertyValue, setRelated, setSentby, setTag, setType, setValue, setXParams, stringFrom, stringFrom
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_DAYLY

public static final byte TYPE_DAYLY
See Also:
Constant Field Values

TYPE_DAILY

public static final byte TYPE_DAILY
See Also:
Constant Field Values

TYPE_WEEKLY

public static final byte TYPE_WEEKLY
See Also:
Constant Field Values

TYPE_MONTHLY

public static final byte TYPE_MONTHLY
See Also:
Constant Field Values

TYPE_MONTH_NTH

public static final byte TYPE_MONTH_NTH
See Also:
Constant Field Values

TYPE_YEARLY

public static final byte TYPE_YEARLY
See Also:
Constant Field Values

TYPE_YEAR_NTH

public static final byte TYPE_YEAR_NTH
See Also:
Constant Field Values

DAY_OF_WEEK_SUNDAY

public static final byte DAY_OF_WEEK_SUNDAY
See Also:
Constant Field Values

DAY_OF_WEEK_MONDAY

public static final byte DAY_OF_WEEK_MONDAY
See Also:
Constant Field Values

DAY_OF_WEEK_TUESDAY

public static final byte DAY_OF_WEEK_TUESDAY
See Also:
Constant Field Values

DAY_OF_WEEK_WEDNESDAY

public static final byte DAY_OF_WEEK_WEDNESDAY
See Also:
Constant Field Values

DAY_OF_WEEK_THURSDAY

public static final byte DAY_OF_WEEK_THURSDAY
See Also:
Constant Field Values

DAY_OF_WEEK_FRIDAY

public static final byte DAY_OF_WEEK_FRIDAY
See Also:
Constant Field Values

DAY_OF_WEEK_SATURDAY

public static final byte DAY_OF_WEEK_SATURDAY
See Also:
Constant Field Values

ALL_DAYS_MASK

public static final short ALL_DAYS_MASK
See Also:
Constant Field Values

UNSPECIFIED

public static final short UNSPECIFIED
See Also:
Constant Field Values
Constructor Detail

RecurrencePattern

public RecurrencePattern(short type,
                         int interval,
                         short monthOfYear,
                         short dayOfMonth,
                         short dayOfWeekMask,
                         short instance,
                         java.lang.String startDatePattern,
                         java.lang.String endDatePattern,
                         boolean noEndDate)
Creates a new instance of RecurrencePattern. Property occurrences will be kept at -1 (unspecified). Client classes can use getXxxRecurrencePattern() instead of this constructor.

Parameters:
frequency -
interval -
monthOfYear -
dayOfMonth -
dayOfWeekMask -
instance -
startDatePattern -
endDatePattern -
noEndDate -

RecurrencePattern

public RecurrencePattern(short type,
                         int interval,
                         short monthOfYear,
                         short dayOfMonth,
                         short dayOfWeekMask,
                         short instance,
                         java.lang.String startDatePattern,
                         java.lang.String endDatePattern,
                         boolean noEndDate,
                         int occurrences)
Creates a new instance of RecurrencePattern. Client classes can use getXxxRecurrencePattern() instead of this constructor.

Parameters:
frequency -
interval -
monthOfYear -
dayOfMonth -
dayOfWeekMask -
instance -
startDatePattern -
endDatePattern -
noEndDate -
occurrences -
Method Detail

getTypeId

public short getTypeId()
Returns the recurrence frequency as a number.

Returns:
value of property frequency

getInterval

public int getInterval()
Returns the interval.

Returns:
Value of property interval

getMonthOfYear

public short getMonthOfYear()
Returns the month of year.

Returns:
Value of property monthOfYear

getDayOfWeekMask

public short getDayOfWeekMask()
Returns the day-of-week mask.

Returns:
Value of property dayOfWeekMask

getDayOfMonth

public short getDayOfMonth()
Returns the day of the month.

Returns:
value of property dayOfMonth

getInstance

public short getInstance()
Returns the instance number.

Returns:
value of property instance

getStartDatePattern

public java.lang.String getStartDatePattern()
Returns the start date pattern.

Returns:
value of property startDatePattern

isNoEndDate

public boolean isNoEndDate()
Returns whether the pattern has no end date set.

Returns:
true if the pattern has no end date set, false otherwise

setNoEndDate

public void setNoEndDate(boolean noEndDate)
Setter for property noEndDate.

Parameters:
noEndDate - new value of property noEndDate

getEndDatePattern

public java.lang.String getEndDatePattern()
Returns the end date pattern.

Returns:
value of property endDatePattern

getOccurrences

public int getOccurrences()
Returns the number of occurrences.

Returns:
value of property occurrences

setOccurrences

public void setOccurrences(int occurrences)
Setter for property occurrences.

Parameters:
occurrences - new value of property occurrences

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern)
                                                   throws RecurrencePatternException
Daily recurrence with start and end dates.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Daily recurrence with start and end dates.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
endDatePattern - end date pattern
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern,
                                                          boolean noEndDate)
                                                   throws RecurrencePatternException
Daily recurrence with start, end dates and noEndDate.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the pattern without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern,
                                                          boolean noEndDate,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Daily recurrence with start, end dates and noEndDate.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern,
                                                          boolean noEndDate,
                                                          int occurrences)
                                                   throws RecurrencePatternException
Daily recurrence

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          java.lang.String endDatePattern,
                                                          boolean noEndDate,
                                                          int occurrences,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Daily recurrence.

Parameters:
interval - how many days between two recurrence
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern)
                                                   throws RecurrencePatternException
Infinite daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Inifinite daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          boolean noEndDate)
                                                   throws RecurrencePatternException
Infinite daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          boolean noEndDate,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Infinite daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          boolean noEndDate,
                                                          int occurrences)
                                                   throws RecurrencePatternException
Daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getDailyRecurrencePattern

public static RecurrencePattern getDailyRecurrencePattern(int interval,
                                                          java.lang.String startDatePattern,
                                                          boolean noEndDate,
                                                          int occurrences,
                                                          short dayOfWeekMask)
                                                   throws RecurrencePatternException
Daily recurrence.

Parameters:
interval - how many days between two recurrences
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
dayOfWeekMask - days when the event or task occurs
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getWeeklyRecurrencePattern

public static RecurrencePattern getWeeklyRecurrencePattern(int interval,
                                                           short dayOfWeekMask,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern)
                                                    throws RecurrencePatternException
Weekly recurrence with start and end dates.

Parameters:
interval - how many weeks between two recurrences
dayOfWeekMask - days when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getWeeklyRecurrencePattern

public static RecurrencePattern getWeeklyRecurrencePattern(int interval,
                                                           short dayOfWeekMask,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern,
                                                           boolean noEndDate)
                                                    throws RecurrencePatternException
Weekly recurrence with start, end dates and noEndDate.

Parameters:
interval - how many weeks between two recurrences
dayOfWeekMask - days when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getWeeklyRecurrencePattern

public static RecurrencePattern getWeeklyRecurrencePattern(int interval,
                                                           short dayOfWeekMask,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern,
                                                           boolean noEndDate,
                                                           int occurrences)
                                                    throws RecurrencePatternException
Weekly recurrence.

Parameters:
interval - how many weeks between two recurrences
dayOfWeekMask - days when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getWeeklyRecurrencePattern

public static RecurrencePattern getWeeklyRecurrencePattern(int interval,
                                                           short dayOfWeekMask,
                                                           java.lang.String startDatePattern)
                                                    throws RecurrencePatternException
Infinite weekly recurrence

Parameters:
interval - how many days between two recurrences
dayOfWeekMask - days when the event or task occurs
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getWeeklyRecurrencePattern

public static RecurrencePattern getWeeklyRecurrencePattern(int interval,
                                                           short dayOfWeekMask,
                                                           java.lang.String startDatePattern,
                                                           boolean noEndDate)
                                                    throws RecurrencePatternException
Infinite weekly recurrence

Parameters:
interval - how many days between two recurrences
dayOfWeekMask - days when the event or task occurs
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern)
                                                     throws RecurrencePatternException
Monthly recurrence with start and end dates.

Parameters:
interval - how many months between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern,
                                                            boolean noEndDate,
                                                            int occurrences)
                                                     throws RecurrencePatternException
Monthly recurrence.

Parameters:
interval - how many months between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern,
                                                            boolean noEndDate)
                                                     throws RecurrencePatternException
Monthly recurrence with start, end dates and noEndDate.

Parameters:
interval - how many months between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern)
                                                     throws RecurrencePatternException
Infinite monthly recurrence.

Parameters:
interval - how many days between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern,
                                                            boolean noEndDate,
                                                            int occurrences)
                                                     throws RecurrencePatternException
Monthly recurrence.

Parameters:
interval - how many days between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthlyRecurrencePattern

public static RecurrencePattern getMonthlyRecurrencePattern(int interval,
                                                            short dayOfMonth,
                                                            java.lang.String startDatePattern,
                                                            boolean noEndDate)
                                                     throws RecurrencePatternException
Infinite monthly recurrence.

Parameters:
interval - how many days between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthNthRecurrencePattern

public static RecurrencePattern getMonthNthRecurrencePattern(int interval,
                                                             short dayOfWeekMask,
                                                             short instance,
                                                             java.lang.String startDatePattern,
                                                             java.lang.String endDatePattern)
                                                      throws RecurrencePatternException
Monthly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many months between two recurrences
dayOfWeekMask - see below
instance - the instance of dayOfWeekMask of every interval months
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wront parameters

getMonthNthRecurrencePattern

public static RecurrencePattern getMonthNthRecurrencePattern(int interval,
                                                             short dayOfWeekMask,
                                                             short instance,
                                                             java.lang.String startDatePattern,
                                                             java.lang.String endDatePattern,
                                                             boolean noEndDate,
                                                             int occurrences)
                                                      throws RecurrencePatternException
Monthly day-of-week-based recurrence with start, end dates and noEndDate.

Parameters:
interval - how many months between two recurrences
dayOfWeekMask - see below
instance - the instance of dayOfWeekMask of every interval months
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthNthRecurrencePattern

public static RecurrencePattern getMonthNthRecurrencePattern(int interval,
                                                             short dayOfWeekMask,
                                                             short instance,
                                                             java.lang.String startDatePattern)
                                                      throws RecurrencePatternException
Monthly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many months between two recurrences
dayOfWeekMask - see below
instance - the instance of dayOfWeekMask of every interval months
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getMonthNthRecurrencePattern

public static RecurrencePattern getMonthNthRecurrencePattern(int interval,
                                                             short dayOfWeekMask,
                                                             short instance,
                                                             java.lang.String startDatePattern,
                                                             boolean noEndDate)
                                                      throws RecurrencePatternException
Monthly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many months between two recurrences
dayOfWeekMask - see below
instance - the instance of dayOfWeekMask of every interval months
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearlyRecurrencePattern

public static RecurrencePattern getYearlyRecurrencePattern(int interval,
                                                           short dayOfMonth,
                                                           short monthOfYear,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern,
                                                           boolean noEndDate)
                                                    throws RecurrencePatternException
Yearly recurrence with start, end dates and noEndDate.

Parameters:
interval - how many years between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearlyRecurrencePattern

public static RecurrencePattern getYearlyRecurrencePattern(int interval,
                                                           short dayOfMonth,
                                                           short monthOfYear,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern,
                                                           boolean noEndDate,
                                                           int occurrences)
                                                    throws RecurrencePatternException
Yearly recurrence.

Parameters:
interval - how many years between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearlyRecurrencePattern

public static RecurrencePattern getYearlyRecurrencePattern(int interval,
                                                           short dayOfMonth,
                                                           short monthOfYear,
                                                           java.lang.String startDatePattern,
                                                           java.lang.String endDatePattern)
                                                    throws RecurrencePatternException
Yearly recurrence with start, end dates and noEndDate

Parameters:
interval - how many years between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearlyRecurrencePattern

public static RecurrencePattern getYearlyRecurrencePattern(int interval,
                                                           short dayOfMonth,
                                                           short monthOfYear,
                                                           java.lang.String startDatePattern)
                                                    throws RecurrencePatternException
Infinite yearly recurrence.

Parameters:
interval - how many years between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearlyRecurrencePattern

public static RecurrencePattern getYearlyRecurrencePattern(int interval,
                                                           short dayOfMonth,
                                                           short monthOfYear,
                                                           java.lang.String startDatePattern,
                                                           boolean noEndDate)
                                                    throws RecurrencePatternException
Infinite yearly recurrence.

Parameters:
interval - how many years between two recurrences
dayOfMonth - day of month (1-31) when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearNthRecurrencePattern

public static RecurrencePattern getYearNthRecurrencePattern(int interval,
                                                            short dayOfWeekMask,
                                                            short monthOfYear,
                                                            short instance,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern,
                                                            boolean noEndDate)
                                                     throws RecurrencePatternException
Yearly day-of-week-based recurrence with start, end dates and noEndDate.

Parameters:
interval - how many years between two recurrences
dayOfWeekMask - days when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
instance - every instance of dayOfWeekMask of monthOfYear
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearNthRecurrencePattern

public static RecurrencePattern getYearNthRecurrencePattern(int interval,
                                                            short dayOfWeekMask,
                                                            short monthOfYear,
                                                            short instance,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern,
                                                            boolean noEndDate,
                                                            int occurrences)
                                                     throws RecurrencePatternException
Yearly day-of-week-based recurrence.

Parameters:
interval - how many years between two recurrences
dayOfWeekMask - days when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
instance - every instance of dayOfWeekMask of monthOfYear
startDatePattern - start date pattern
endDatePattern - end date pattern
noEndDate - is the recurrence without end date?
occurrences - number of occurrences
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearNthRecurrencePattern

public static RecurrencePattern getYearNthRecurrencePattern(int interval,
                                                            short dayOfWeekMask,
                                                            short monthOfYear,
                                                            short instance,
                                                            java.lang.String startDatePattern,
                                                            java.lang.String endDatePattern)
                                                     throws RecurrencePatternException
Yearly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many years between two recurrences
dayOfWeekMask - days when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
instance - every instance of dayOfWeekMask of monthOfYear
startDatePattern - start date pattern
endDatePattern - end date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearNthRecurrencePattern

public static RecurrencePattern getYearNthRecurrencePattern(int interval,
                                                            short dayOfWeekMask,
                                                            short monthOfYear,
                                                            short instance,
                                                            java.lang.String startDatePattern)
                                                     throws RecurrencePatternException
Yearly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many years between two recurrences
dayOfWeekMask - days when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
instance - every instance of dayOfWeekMask of monthOfYear
startDatePattern - start date pattern
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getYearNthRecurrencePattern

public static RecurrencePattern getYearNthRecurrencePattern(int interval,
                                                            short dayOfWeekMask,
                                                            short monthOfYear,
                                                            short instance,
                                                            java.lang.String startDatePattern,
                                                            boolean noEndDate)
                                                     throws RecurrencePatternException
Yearly day-of-week-based recurrence with start and end dates.

Parameters:
interval - how many years between two recurrences
dayOfWeekMask - days when the event or task occurs
monthOfYear - month (1-12) of the year when the event or task occurs
instance - every instance of dayOfWeekMask of monthOfYear
startDatePattern - start date pattern
noEndDate - is the recurrence without end date?
Returns:
the newly created RecurrencePattern object
Throws:
RecurrencePatternException - in case of wrong parameters

getTypeDesc

public java.lang.String getTypeDesc()
Gives a vCalendar short form for the recurrence frequency.

Returns:
"D" for daily recurrence "W" for weekly recurrence "MP" for monthly recurrence (monthly by position) "MD" for monthly day-of-week-based recurrence (monthly by day) "YM" for yearly recurrence (yearly by month)

getDayOfWeek

public java.util.List<java.lang.String> getDayOfWeek()
Return a list of abbreviations of days of week in which the task or event recurs.

Returns:
the list of days of the week ("SU", "MO", etc.)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getExceptions

public java.util.List<ExceptionToRecurrenceRule> getExceptions()
Gets the exception list, duplicate-free and ordered.

Returns:
the exceptions as a List collection

setExceptions

public void setExceptions(java.util.List<ExceptionToRecurrenceRule> exceptions)
Sets the exception list. Being a list, there could be duplicates but they will be removed by the getter in any case.

Parameters:
exceptions - the exceptions as a List collection

setExceptions

public void setExceptions(java.util.SortedSet<ExceptionToRecurrenceRule> exceptions)
Sets the exception set. It is still saved internally as an ArrayList though.

Parameters:
exceptions - the exceptions as a SortedSet collection

fix

public boolean fix()
            throws RecurrencePatternException
Fixes missing data on the basis of the startDatePattern field, according to the inference rules prescribed by the specifications (missing data must be inferred by the start date).

Returns:
true if a fix was needed
Throws:
RecurrencePatternException - if no automatic fix was possible


Copyright © 2001-2009 Funambol.