Package org.apache.cassandra.utils
Class IntervalTree<C extends Comparable<? super C>,D extends Comparable<? super D>,I extends Interval<C,D>>
java.lang.Object
org.apache.cassandra.utils.IntervalTree<C,D,I>
- All Implemented Interfaces:
Iterable<I>
- Direct Known Subclasses:
SSTableIntervalTree
public class IntervalTree<C extends Comparable<? super C>,D extends Comparable<? super D>,I extends Interval<C,D>>
extends Object
implements Iterable<I>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIntervalTree(I[] minSortedIntervals, I[] maxSortedIntervals) This constructor will not modify minSortedIntervals and maxSortedIntervals, but it also won't make defensive copies and will keep the originals.protectedIntervalTree(Collection<I> intervals) -
Method Summary
Modifier and TypeMethodDescriptionstatic <C extends Comparable<? super C>,D extends Comparable<? super D>, I extends Interval<C, D>>
IntervalTree<C,D, I> build(Collection<I> intervals) protected IntervalTree<C,D, I> static <C extends Comparable<? super C>,D extends Comparable<? super D>, I extends Interval<C, D>>
IntervalTree<C,D, I> booleanfinal inthashCode()intbooleanisEmpty()iterator()max()min()toString()IntervalTree<C,D, I> The input arrays aren't defensively copied and will be sorted.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EXPENSIVE_CHECKS
public static final boolean EXPENSIVE_CHECKS -
EMPTY_ARRAY
-
-
Constructor Details
-
IntervalTree
-
IntervalTree
This constructor will not modify minSortedIntervals and maxSortedIntervals, but it also won't make defensive copies and will keep the originals.
-
-
Method Details
-
create
-
build
public static <C extends Comparable<? super C>,D extends Comparable<? super D>, IntervalTree<C,I extends Interval<C, D>> D, buildI> (Collection<I> intervals) -
emptyTree
public static <C extends Comparable<? super C>,D extends Comparable<? super D>, IntervalTree<C,I extends Interval<C, D>> D, emptyTree()I> -
intervalCount
public int intervalCount() -
isEmpty
public boolean isEmpty() -
max
-
min
-
search
-
search
-
update
The input arrays aren't defensively copied and will be sorted. The update method doesn't allow duplicates or elements to be removed to be missing and this differs from the constructor which does not duplicate checking at all. It made more sense for update to be stricter because it is tracking removals and additions explicitly instead of building a list from scratch and in the targeted use case of a list of SSTables there are no duplicates. At a given point in time an sstable represents exactly one interval (although it may switch via removal and addition as in early open). -
iterator
- Specified by:
iteratorin interfaceIterable<C extends Comparable<? super C>>
-
toString
-
equals
-
hashCode
public final int hashCode()
-