findBasedOn

fun findBasedOn(r: Recurrence, startDate: Long, base: Long, baseCount: Int, amount: Int, fromDate: Long = Recurrence.DATE_NONE, includeStart: Boolean = true): MutableList<Long>

Get event dates of a recurrence based on a previous event date of the same recurrence. If the recurrence has an end by count rule, it's important to also supply the base count to indicate how many events have happened as of the base date so the algorithm knows when to stop. Starting from a date, a certain amount of events are found and returned. All events will have the same time of the day as the startDate.

While using this method is a bit more complicated than using find, it will be more performant to find a recurrence event if previous event dates are known. For example, finding the 1000th event when the first 999 events are known.

Parameters

r

The recurrence.

startDate

The start date of the recurring event, cannot be Recurrence.DATE_NONE.

base

The base event date. Might get added to the returned list of events depending on the fromDate value.

baseCount

The number of events that have happened as of the base date. If the base date is the start date, this should be 1 since only the event on the start date has happened. This value is only used if the recurrence has an end by count rule. Any value can safely be used otherwise.

amount

The maximum number of events to find, must be at least 0.

fromDate

The date from which to start finding recurrence events. Can be set to Recurrence.DATE_NONE to find events from the start date of the recurrence.

includeStart

Whether the startDate or fromDate should be included in the list of events.