Interface CalendarEventOccurrenceGenerator

    • Method Detail

      • get

        static CalendarEventOccurrenceGenerator get()
        Gets an instance of the default implementation of this generator.
        Returns:
        a generator of event occurrences.
      • generateOccurrencesIn

        default List<CalendarEventOccurrence> generateOccurrencesIn​(CalendarTimeWindow timeWindow)
        Generates the actual occurrences of the calendar events that occur in the specified window of time. The occurrences are computed from specified window of time that implies a set of events planned in this period. This method doesn't require to be implemented.
        Parameters:
        timeWindow - the time window in which the events occur.
        Returns:
        a set of event occurrences that occur in the specified window of time sorted by the datetime at which they start.
      • generateOccurrencesOf

        List<CalendarEventOccurrence> generateOccurrencesOf​(List<CalendarEvent> events,
                                                            Period inPeriod)
        Generates the actual occurrences of the specified events and that occur in the period of time. The occurrences are computed from the recurrence rule of the specified events, from the date and times at which the events start, and for the specified period of time. This method require to be implemented.
        Parameters:
        events - the events.
        inPeriod - the period of time the instances of the events occur.
        Returns:
        a set of event occurrences that occur in the specified period sorted by the date and time at which they start.
      • countOccurrencesOf

        long countOccurrencesOf​(CalendarEvent event,
                                Period inPeriod)
        Counts the number of occurrences of the specified event in the given period. If the period is null, then the period over which the event recurs is taken into account. This method is a faster way to compute the occurrence count of an event by considering only its recurrence rule and by not generating any occurrences.
        Parameters:
        event - an event.
        inPeriod - the period of time the instances of the events occur. It can be null, in this case the recurrence period is taken in the computation.
        Returns:
        the number of occurrences of the event occurring in the specified period or -1 if the event isn't yet planned or Long.MAX_VALUE if there an unlimited number of occurrences (endless recurrence).
      • generateNextOccurrenceOf

        CalendarEventOccurrence generateNextOccurrenceOf​(CalendarEvent event,
                                                         ZonedDateTime since)
        Generates the next occurrence of the specified event since the given date time. The next occurrence is computed from the recurrence rule of the specified event, from the date and times at which the events start, from the specified date, and from recurrence exceptions. This method requires to be implemented.
        Parameters:
        event - an event.
        since - the date time since which the next occurrence must be computed. No occurrence occurring at this exact given date time (with a precision of one minute) isn't taken into account.
        Returns:
        the next occurrence of the given event, null if not CalendarEventOccurrence can be computed.