Class ByDay
java.lang.Object
jfxtras.icalendarfx.VElementBase
jfxtras.icalendarfx.properties.component.recurrence.rrule.RRulePartBase<List<ByDay.ByDayPair>, ByDay>
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 VElementBase
VElementBase.Message, VElementBase.MessageEffect -
Field Summary
FieldsFields inherited from class RRulePartBase
elementTypeFields inherited from class VElementBase
BEGIN, END -
Constructor Summary
ConstructorsConstructorDescriptionByDay()Parse iCalendar compliant list of days of the week.Constructor that usesvalues without a preceding integer.invalid reference
DayofWeekByDay(Collection<DayOfWeek> daysOfWeek) Constructor that usesCollection.invalid reference
DayofWeekByDay(ByDay.ByDayPair... byDayPairs) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDayOfWeek(DayOfWeek dayOfWeek) add individual, without ordinal value, to BYDAY ruleinvalid reference
DayofWeekprivate 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 individualin BYDAY rule Ifinvalid reference
DayofWeekByDay.ByDayPaircontains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingvaluesinvalid reference
DayofWeekstreamRecurrences(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 ByRuleAbstract
compareTo, errors, setValue, setValue, setValue, withValue, withValueMethods inherited from class RRulePartBase
equals, extractValue, getParent, getValue, hashCode, name, setParent, withValueMethods inherited from class VElementBase
elementName, isContentValid, newEmptyVElement, parse, throwMessageExceptions
-
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 usesvalues without a preceding integer. All days of the provided types are included within the specified frequencyinvalid reference
DayofWeek -
ByDay
Constructor that usesCollection. No ordinals are allowed.invalid reference
DayofWeek
-
-
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 individual, without ordinal value, to BYDAY ruleinvalid reference
DayofWeek- Parameters:
dayOfWeek-to add, without ordinalinvalid reference
DayofWeek- Returns:
- true if added, false if DayOfWeek already present
-
removeDayOfWeek
remove individual DayofWeek from BYDAY rule- Parameters:
dayOfWeek-to removeinvalid reference
DayofWeek- Returns:
- true if removed, false if not present
-
replaceDayOfWeek
Replace individualin BYDAY rule Ifinvalid reference
DayofWeekByDay.ByDayPaircontains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingvaluesinvalid reference
DayofWeek- Parameters:
original-to removeinvalid reference
DayofWeekreplacement-to addinvalid reference
DayofWeek- Returns:
- true if replaced, false if original is not present
-
dayOfWeekWithoutOrdinalList
-
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
-