T
- the nature of ending pointspublic class ComparableIntervalsList<T extends Comparable<T>> extends TreeSet<ComparableInterval<T>>
ComparableInterval
.
It extends a TreeSet of ComparableInterval
instances. Since the objects of the list implement the
ComparableInterval
class, the list is an ordered collection.
The generic class must implement java.lang.Comparable
It is HIGHLY recommended this class be immutable!
ComparableInterval
,
TreeSet
,
Serialized FormConstructor and Description |
---|
ComparableIntervalsList() |
Modifier and Type | Method and Description |
---|---|
ComparableInterval<T> |
getInclusiveInterval()
Returns the shortest interval that contains all the intervals of the list.
|
ComparableIntervalsList<T> |
getIntersectionWith(ComparableInterval<T> interval)
Returns the intersection between an interval and all the intervals of the list.
|
ComparableIntervalsList<T> |
getIntervalsContaining(T entry)
Returns the intervals of the list that contain the provided entry.
|
ComparableIntervalsList<T> |
getMergedIntervals()
Merges the intervals of the list that overlap and returns the list of merged intervals.
|
boolean |
includes(ComparableInterval<T> interval)
Returns true if the provided interval is included in one of the intervals of the list.
|
boolean |
overlaps(ComparableInterval<T> interval)
Returns true if the provided interval overlaps one of the intervals of the list.
|
add, addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
equals, hashCode, removeAll
containsAll, retainAll, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
parallelStream, removeIf, stream
public boolean overlaps(ComparableInterval<T> interval)
interval
- the intervalpublic boolean includes(ComparableInterval<T> interval)
interval
- the intervalpublic ComparableIntervalsList<T> getIntervalsContaining(T entry)
The list returned can be empty if the entry is not contained in any interval.
entry
- the entrypublic ComparableInterval<T> getInclusiveInterval()
While an entry included in at least one of the listed intervals must be contained in this global interval, the opposite is not guaranteed (the inclusive interval can contain entries that do not belong to any listed interval).
public ComparableIntervalsList<T> getMergedIntervals()
The list returned should not contain any overlapping intervals.
public ComparableIntervalsList<T> getIntersectionWith(ComparableInterval<T> interval)
The list returned can be empty if the provided interval does not intersects any interval of the list.
interval
- the intervalCopyright © 2023 CNES. All rights reserved.