Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.fortuna.ical4j.model
Class PeriodList

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractSet<E>
              java.util.TreeSet
                  net.fortuna.ical4j.model.PeriodList

All Implemented Interfaces:
  Serializable, Cloneable, Iterable, Collection, Set, SortedSet

    public class PeriodList

extends TreeSet
implements Serializable

Defines a list of iCalendar periods. NOTE: By implementing the `java.util.SortedSet` interface period lists will always be sorted according to natural ordering.

Author:
  Ben Fortuna
See Also:
  Serialized Form

Constructor Summary
`PeriodList()` Default constructor.
`PeriodList(boolean utc)`
`PeriodList(String aValue)` Parses the specified string representation to create a list of periods.

Method Summary
`boolean` | `add(Object arg0)` Overrides superclass to throw an `IllegalArgumentException` where argument is not a `net.fortuna.ical4j.model.Period`.
`boolean` | `add(Period period)` Add a period to the list.
`PeriodList` | `add(PeriodList periods)` A convenience method that adds all the periods in the specified list to this list.
`TimeZone` | `getTimeZone()`
`boolean` | `isUtc()` Indicates whether this list is in local or UTC format.
`PeriodList` | `normalise()` Returns a normalised version of this period list.
`boolean` | `remove(Period period)` Remove a period from the list.
`void` | `setTimeZone(TimeZone timeZone)` Applies the specified timezone to all dates in the list.
`void` | `setUtc(boolean utc)` Sets whether this list is in UTC or local time format.
`PeriodList` | `subtract(PeriodList 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.
`String` | `toString()`

Methods inherited from class java.util.TreeSet
`addAll, clear, clone, comparator, contains, first, headSet, isEmpty, iterator, last, remove, size, subSet, tailSet`

Methods inherited from class java.util.AbstractSet
`equals, hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`containsAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray`

Constructor Detail

### PeriodList

    public PeriodList()

  Default constructor.

### PeriodList

    public PeriodList(boolean utc)

Parameters:
  `utc` -

### PeriodList

    public PeriodList(String aValue)
               throws ParseException

  Parses the specified string representation to create a list of periods.

  Parameters:
    `aValue` - a string representation of a list of periods
  Throws:
    `ParseException` - thrown when an invalid string representation of a period list is specified

Method Detail

### toString

    public final String toString()

  Overrides:
    `toString` in class `AbstractCollection`
  See Also:
    `AbstractCollection.toString()`

### add

    public final boolean add(Period period)

  Add a period to the list.

  Parameters:
    `period` - the period to add
  Returns:
    true
  See Also:
    `List.add(java.lang.Object)`

### add

    public final boolean add(Object arg0)

  Overrides superclass to throw an `IllegalArgumentException` where argument is not a `net.fortuna.ical4j.model.Period`.

  Specified by:
    `add` in interface `Collection`
  Specified by:
    `add` in interface `Set`
  Overrides:
    `add` in class `TreeSet`
  See Also:
    `java.util.List#add(E)`

### remove

    public final boolean remove(Period 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 normalise()

  Returns a normalised version of this period list. Normalisation includes combining overlapping periods, removing periods contained by other periods, and combining adjacent periods. NOTE: If the period list is already normalised then this period list is returned.

  Returns:
    a period list

### add

    public final PeriodList add(PeriodList periods)

  A convenience method that adds all the periods in the specified list to this list. Normalisation is also performed automatically after all periods have been added.

  Parameters:
    `periods` -

### subtract

    public final PeriodList subtract(PeriodList 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:
    `periods` - a list of periods to subtract from this list
  Returns:
    a period list

### isUtc

    public final boolean isUtc()

  Indicates whether this list is in local or UTC format.

  Returns:
    Returns true if in UTC format, otherwise false.

### setUtc

    public final void setUtc(boolean utc)

  Sets whether this list is in UTC or local time format.

  Parameters:
    `utc` - The utc to set.

### setTimeZone

    public final void setTimeZone(TimeZone timeZone)

  Applies the specified timezone to all dates in the list. All dates added to this list will also have this timezone applied.

  Parameters:
    `timezone` -

### getTimeZone

    public final TimeZone getTimeZone()

  Returns:
    Returns the timeZone.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2007 Modularity. All Rights Reserved.