Class PeriodList<T extends Temporal>

  • All Implemented Interfaces:
    Serializable

    public class PeriodList<T extends Temporal>
    extends Object
    implements Serializable
    $Id$ [23-Apr-2004] Defines a list of iCalendar periods. This class encapsulates a collection of naturally sorted periods that SHOULD conform to a common set of rules, including temporal type, applicable timezone and string representation (format). Results for a consumed time query will have the same temporal type, format type and (where applicable) timezone as the event start date. Results for a free-busy query will always be defined in UTC time (i.e. using temporal type Instant) NOTE: By implementing the java.util.SortedSet interface period lists will always be sorted according to natural ordering.
    See Also:
    Serialized Form
    • Method Detail

      • parse

        public static <T extends TemporalPeriodList<T> parse​(String aValue)
        Parses the specified string representation to create a list of periods.
        Parameters:
        aValue - a string representation of a list of periods
        Throws:
        DateTimeParseException - thrown when an invalid string representation of a period list is provided
      • remove

        public final PeriodList<T> remove​(Object period)
        Remove a period from the list.
        Parameters:
        period - the period to remove
        Returns:
        true if the list contained the specified period
        See Also:
        List.remove(java.lang.Object)
      • normalise

        public final PeriodList<T> normalise()
        Returns a normalised version of this period list. Normalisation includes combining overlapping periods, removing periods contained by other periods, combining adjacent periods, and removing periods that consume no time. NOTE: If the period list is already normalised then this period list is returned.
        Returns:
        a period list
      • add

        public final PeriodList<T> add​(PeriodList<T> periods)
        A convenience method that combines all the periods in the specified list to this list. The result returned is a new PeriodList instance, except where no periods are specified in the arguments. In such cases this instance is returned. Normalisation is also performed automatically after all periods have been added.
        Parameters:
        periods - a list of periods to add
        Returns:
        a period list instance
      • subtract

        public final PeriodList<T> subtract​(PeriodList<T> subtractions)
        Subtracts the intersection of this list with the specified list of periods from this list and returns the results as a new period list. If no intersection is identified this list is returned.
        Parameters:
        subtractions - a list of periods to subtract from this list
        Returns:
        a period list
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object