Package org.dmfs.rfc5545.recur
Class RecurrenceRule.WeekdayNum
java.lang.Object
org.dmfs.rfc5545.recur.RecurrenceRule.WeekdayNum
- Enclosing class:
- RecurrenceRule
This class represents the position of a
Weekday in a specific range. It parses values like -4SU which means the fourth last Sunday
in the interval or 2MO which means the second Monday in the interval. In addition this class accepts simple weekdays like SU
which means every Sunday in the interval. These values are defined as:
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWeekdayNum(int pos, org.dmfs.rfc5545.Weekday weekday) Create a new WeekdayNum instance. -
Method Summary
Modifier and TypeMethodDescriptiontoString()static RecurrenceRule.WeekdayNumParse a weekdaynum String as defined in RFC 5545 (this definition equals the definition in RFC 2445).static RecurrenceRule.WeekdayNumParse a weekdaynum String as defined in RFC 5545 (this definition equals the definition in RFC 2445).
-
Field Details
-
pos
public final int posThe position of this weekday in the interval. This value is0if this instance means every occurrence ofweekdayin the interval. -
weekday
public final org.dmfs.rfc5545.Weekday weekdayTheWeekday.
-
-
Constructor Details
-
WeekdayNum
public WeekdayNum(int pos, org.dmfs.rfc5545.Weekday weekday) Create a new WeekdayNum instance.TODO: update range check
- Parameters:
pos- The position of the weekday in the Interval or0for every occurrence of the weekday.weekday- TheWeekday.
-
-
Method Details
-
valueOf
public static RecurrenceRule.WeekdayNum valueOf(String value, boolean tolerant) throws InvalidRecurrenceRuleException Parse a weekdaynum String as defined in RFC 5545 (this definition equals the definition in RFC 2445).- Parameters:
value- The weekdaynum String to parse.tolerant- Set totrueto be tolerant and accept values outside of the allowed range.- Returns:
- A new
RecurrenceRule.WeekdayNuminstance. - Throws:
InvalidRecurrenceRuleException- If the weekdaynum string is invalid.
-
valueOf
Parse a weekdaynum String as defined in RFC 5545 (this definition equals the definition in RFC 2445). In contrast tovalueOf(String, boolean)this method is always strict and throws on every invalid value.- Parameters:
value- The weekdaynum String to parse.- Returns:
- A new
RecurrenceRule.WeekdayNuminstance. - Throws:
InvalidRecurrenceRuleException- If the weekdaynum string is invalid.
-
toString
-