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 class
Contains 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
elementType
Fields inherited from class jfxtras.icalendarfx.VElementBase
BEGIN, END
-
Constructor Summary
ConstructorsConstructorDescriptionByDay()
Parse iCalendar compliant list of days of the week.Constructor that usesDayofWeek
values without a preceding integer.ByDay
(Collection<DayOfWeek> daysOfWeek) Constructor that usesDayofWeek
Collection.ByDay
(ByDay.ByDayPair... byDayPairs) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addDayOfWeek
(DayOfWeek dayOfWeek) add individualDayofWeek
, without ordinal value, to BYDAY ruleprivate TemporalAdjuster
dayOfWeekInYear
(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 DayOfWeek
Start of week - default start of week is Mondayboolean
Checks if byDayPairs has ordinal values.static ByDay
protected List<VElementBase.Message>
parseContent
(String dayPairs) Parse content line into calendar element.boolean
removeDayOfWeek
(DayOfWeek dayOfWeek) remove individual DayofWeek from BYDAY ruleboolean
replaceDayOfWeek
(DayOfWeek originalDayOfWeek, DayOfWeek replacemenDayOfWeekt) Replace individualDayofWeek
in BYDAY rule IfByDay.ByDayPair
contains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingDayofWeek
valuesstreamRecurrences
(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, withValue
Methods inherited from class jfxtras.icalendarfx.properties.component.recurrence.rrule.RRulePartBase
equals, extractValue, getParent, getValue, hashCode, name, setParent, withValue
Methods inherited from class jfxtras.icalendarfx.VElementBase
elementName, isContentValid, newEmptyVElement, parse, throwMessageExceptions
Methods 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 usesDayofWeek
values without a preceding integer. All days of the provided types are included within the specified frequency -
ByDay
Constructor that usesDayofWeek
Collection. 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
-DayofWeek
to add, without ordinal- Returns:
- true if added, false if DayOfWeek already present
-
removeDayOfWeek
remove individual DayofWeek from BYDAY rule- Parameters:
dayOfWeek
-DayofWeek
to remove- Returns:
- true if removed, false if not present
-
replaceDayOfWeek
Replace individualDayofWeek
in BYDAY rule IfByDay.ByDayPair
contains a non-zero ordinal, the replacement contains the same ordinal value Note: a zero ordinal means include all matchingDayofWeek
values- Parameters:
original
-DayofWeek
to removereplacement
-DayofWeek
to 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:
toString
in classRRulePartBase<List<ByDay.ByDayPair>,
ByDay>
-
streamRecurrences
public Stream<Temporal> streamRecurrences(Stream<Temporal> inStream, ChronoUnit chronoUnit, Temporal dateTimeStart) Description copied from interface:ByRule
New stream of date/times made after applying rule that either filters out some date/times or adds additional date/times.- Specified by:
streamRecurrences
in interfaceByRule<List<ByDay.ByDayPair>>
- Overrides:
streamRecurrences
in 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:VElementBase
Parse content line into calendar element. If element contains childrenVElementBase.parseContent(String)
is invoked recursively to parse child elements also- Specified by:
parseContent
in classVElementBase
- Parameters:
dayPairs
- calendar content string to parse- Returns:
- log of information and error messages
-
parse
-