Package net.fortuna.ical4j.model
Class PeriodList
java.lang.Object
net.fortuna.ical4j.model.PeriodList
- All Implemented Interfaces:
Serializable,Iterable<Period>,Collection<Period>,Set<Period>
$Id$ [23-Apr-2004]
Defines a list of iCalendar periods. NOTE: By implementing the
java.util.SortedSet interface period lists will always be
sorted according to natural ordering.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.PeriodList(boolean utc) PeriodList(boolean utc, boolean unmodifiable) PeriodList(String aValue) Parses the specified string representation to create a list of periods. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanAdd a period to the list.final PeriodListadd(PeriodList periods) A convenience method that combines all the periods in the specified list to this list.booleanaddAll(Collection<? extends Period> arg0) voidclear()booleanbooleancontainsAll(Collection<?> arg0) booleanfinal TimeZoneinthashCode()booleanisEmpty()booleanfinal booleanisUtc()Indicates whether this list is in local or UTC format.iterator()final PeriodListReturns a normalised version of this period list.final booleanRemove a period from the list.booleanremoveAll(Collection<?> arg0) booleanretainAll(Collection<?> arg0) final voidsetTimeZone(TimeZone timeZone) Applies the specified timezone to all dates in the list.final voidsetUtc(boolean utc) Sets whether this list is in UTC or local time format.intsize()final PeriodListsubtract(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.Object[]toArray()<T> T[]toArray(T[] arg0) final StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
PeriodList
public PeriodList()Default constructor. -
PeriodList
public PeriodList(boolean utc) - Parameters:
utc- indicates whether the period list is in UTC time
-
PeriodList
public PeriodList(boolean utc, boolean unmodifiable) - Parameters:
utc- indicates whether the period list is in UTC time
-
PeriodList
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 Details
-
toString
-
add
Add a period to the list. -
remove
Remove a period from the list. -
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
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
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
-
isUtc
public final boolean isUtc()Indicates whether this list is in local or UTC format.- Returns:
- Returns true if in UTC format, otherwise false.
-
isUnmodifiable
public boolean isUnmodifiable() -
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
Applies the specified timezone to all dates in the list. All dates added to this list will also have this timezone applied.- Parameters:
timeZone- the timezone for the period list
-
getTimeZone
- Returns:
- Returns the timeZone.
-
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<Period>- Specified by:
containsAllin interfaceSet<Period>
-
isEmpty
public boolean isEmpty() -
iterator
-
removeAll
-
retainAll
-
size
public int size() -
toArray
-
toArray
public <T> T[] toArray(T[] arg0) -
equals
-
hashCode
public int hashCode()
-