You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rework recurrence iteration
fixes#35#101
This commit deprecates the old recurrenceset implementation and adds a
new one.
Handling of the first instance is now determined by chosing the right
`InstanceIterable`, `RuleInstances` vs. `FirstAndRuleInstances`.
Also in this commit:
* Upgrade gradle -> gradle 7.4
* Upgrade jems -> jems2
* Upgrade JUnit -> Jupiter
DateTime start =RecurrenceRuleIterator it = rule.iterator(start);
42
42
43
-
RecurrenceRuleIterator it = rule.iterator(start);
43
+
int maxInstances =100; // limit instances for rules that recur forever
44
+
45
+
while (it.hasNext() && (!rule.isInfinite() || maxInstances-->0))
46
+
{
47
+
DateTime nextInstance = it.nextDateTime();
48
+
// do something with nextInstance
49
+
}
50
+
```
44
51
45
-
int maxInstances = 100; // limit instances for rules that recur forever
52
+
### Iterating Recurrence Sets
46
53
47
-
while (it.hasNext() && (!rule.isInfinite() || maxInstances-- > 0))
48
-
{
49
-
DateTime nextInstance = it.nextDateTime();
50
-
// do something with nextInstance
51
-
}
54
+
This library also supports processing of EXRULEs, RDATEs and EXDATEs, i.e. complete recurrence sets.
52
55
53
-
This library also supports processing of EXRULEs, RDATEs and EXDATEs, i.e. complete recurrence sets. To iterate a recurrence set use the following code:
56
+
In order to iterate a recurrence set you first compose the set from its components:
Be aware that RRULEs are infinite if they specify neither `COUNT` nor `UNTIL`. This might easily result in an infinite loop when you just iterate over the recurrence set like above.
152
+
153
+
One way to address this is by adding a decorator like `First` from the `jems2` library:
0 commit comments