Module jfxtras.icalendarfx
Class ByDay
java.lang.Object
jfxtras.icalendarfx.VElementBase
jfxtras.icalendarfx.properties.component.recurrence.rrule.RRulePartBase<List<T>,U>
jfxtras.icalendarfx.properties.component.recurrence.rrule.byxxx.ByRuleAbstract<ByDay.ByDayPair,ByDay>
jfxtras.icalendarfx.properties.component.recurrence.rrule.byxxx.ByDay
- All Implemented Interfaces:
Comparable<ByRule<List<ByDay.ByDayPair>>>,ByRule<List<ByDay.ByDayPair>>,RRulePart<List<ByDay.ByDayPair>>,VChild,VElement
BYDAY from RFC 5545, iCalendar 3.3.10, page 40
The BYDAY rule part specifies a COMMA-separated list of days of
the week; SU indicates Sunday; MO indicates Monday; TU indicates
Tuesday; WE indicates Wednesday; TH indicates Thursday; FR
indicates Friday; and SA indicates Saturday.
Each BYDAY value can also be preceded by a positive (+n) or
negative (-n) integer. If present, this indicates the nth
occurrence of a specific day within the MONTHLY or YEARLY "RRULE".
For example, within a MONTHLY rule, +1MO (or simply 1MO)
represents the first Monday within the month, whereas -1MO
represents the last Monday of the month. The numeric value in a
BYDAY rule part with the FREQ rule part set to YEARLY corresponds
to an offset within the month when the BYMONTH rule part is
present, and corresponds to an offset within the year when the
BYWEEKNO or BYMONTH rule parts are present. If an integer
modifier is not present, it means all days of this type within the
specified frequency. For example, within a MONTHLY rule, MO
represents all Mondays within the month. The BYDAY rule part MUST
NOT be specified with a numeric value when the FREQ rule part is
not set to MONTHLY or YEARLY. Furthermore, the BYDAY rule part
MUST NOT be specified with a numeric value with the FREQ rule part
set to YEARLY when the BYWEEKNO rule part is specified.
Element value is a ByDayPair that contains a DayOfWeek and an optional ordinal int.
if the ordinal int is 0 then it is ignored and all values matching the DayOfWeek are included.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContains both the day of the week and an optional positive or negative integer (ordinal).Nested classes/interfaces inherited from class jfxtras.icalendarfx.VElementBase
VElementBase.Message, VElementBase.MessageEffect -
Field Summary
FieldsFields inherited from class jfxtras.icalendarfx.properties.component.recurrence.rrule.RRulePartBase
elementTypeFields inherited from class jfxtras.icalendarfx.VElementBase
BEGIN, END -
Constructor Summary
ConstructorsConstructorDescriptionByDay()Parse iCalendar compliant list of days of the week.Constructor that usesDayofWeekvalues without a preceding integer.ByDay(Collection<DayOfWeek> daysOfWeek) Constructor that usesDayofWeekCollection.ByDay(ByDay.ByDayPair... byDayPairs) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDayOfWeek(DayOfWeek dayOfWeek) add individualDayofWeek, without ordinal value, to BYDAY ruleprivate TemporalAdjusterdayOfWeekInYear(int ordinal, DayOfWeek dayOfWeek) Finds nth occurrence of a week in a year.Return a list of days of the week that don't have an ordinal (as every FRIDAY)private DayOfWeekStart of week - default start of week is MondaybooleanChecks if byDayPairs has ordinal values.static ByDayprotected List<VElementBase.Message>parseContent(String dayPairs) Parse content line into calendar element.booleanremoveDayOfWeek(DayOfWeek dayOfWeek) remove individual DayofWeek from BYDAY rulebooleanreplaceDayOfWeek(DayOfWeek originalDayOfWeek, DayOfWeek replacemenDayOfWeekt) Replace individualDayofWeekin BYDAY rule IfByDay.ByDayPaircontains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingDayofWeekvaluesstreamRecurrences(Stream<Temporal> inStream, ChronoUnit chronoUnit, Temporal dateTimeStart) New stream of date/times made after applying rule that either filters out some date/times or adds additional date/times.toString()Methods inherited from class jfxtras.icalendarfx.properties.component.recurrence.rrule.byxxx.ByRuleAbstract
compareTo, errors, setValue, setValue, setValue, withValue, withValueMethods inherited from class jfxtras.icalendarfx.properties.component.recurrence.rrule.RRulePartBase
equals, extractValue, getParent, getValue, hashCode, name, setParent, withValueMethods inherited from class jfxtras.icalendarfx.VElementBase
elementName, isContentValid, newEmptyVElement, parse, throwMessageExceptionsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
MIN_DAYS_IN_WEEK
private static final int MIN_DAYS_IN_WEEK- See Also:
-
-
Constructor Details
-
ByDay
public ByDay()Parse iCalendar compliant list of days of the week. For example 1MO,2TU,4SA -
ByDay
-
ByDay
-
ByDay
Constructor that usesDayofWeekvalues without a preceding integer. All days of the provided types are included within the specified frequency -
ByDay
Constructor that usesDayofWeekCollection. No ordinals are allowed.
-
-
Method Details
-
getWeekStart
Start of week - default start of week is Monday -
hasOrdinals
public boolean hasOrdinals()Checks if byDayPairs has ordinal values. If so returns true, otherwise false -
addDayOfWeek
add individualDayofWeek, without ordinal value, to BYDAY rule- Parameters:
dayOfWeek-DayofWeekto add, without ordinal- Returns:
- true if added, false if DayOfWeek already present
-
removeDayOfWeek
remove individual DayofWeek from BYDAY rule- Parameters:
dayOfWeek-DayofWeekto remove- Returns:
- true if removed, false if not present
-
replaceDayOfWeek
Replace individualDayofWeekin BYDAY rule IfByDay.ByDayPaircontains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingDayofWeekvalues- Parameters:
original-DayofWeekto removereplacement-DayofWeekto add- Returns:
- true if replaced, false if original is not present
-
dayOfWeekWithoutOrdinalList
Return a list of days of the week that don't have an ordinal (as every FRIDAY) -
toString
- Overrides:
toStringin classRRulePartBase<List<ByDay.ByDayPair>,ByDay>
-
streamRecurrences
public Stream<Temporal> streamRecurrences(Stream<Temporal> inStream, ChronoUnit chronoUnit, Temporal dateTimeStart) Description copied from interface:ByRuleNew stream of date/times made after applying rule that either filters out some date/times or adds additional date/times.- Specified by:
streamRecurrencesin interfaceByRule<List<ByDay.ByDayPair>>- Overrides:
streamRecurrencesin classByRuleAbstract<ByDay.ByDayPair,ByDay> - Parameters:
inStream- - Current stream to be added to or subtracted fromchronoUnit- - ChronoUnit of last modification to inStream- Returns:
-
dayOfWeekInYear
Finds nth occurrence of a week in a year. Based on TemporalAdjusters.dayOfWeekInMonth -
parseContent
Description copied from class:VElementBaseParse content line into calendar element. If element contains childrenVElementBase.parseContent(String)is invoked recursively to parse child elements also- Specified by:
parseContentin classVElementBase- Parameters:
dayPairs- calendar content string to parse- Returns:
- log of information and error messages
-
parse
-