Package org.apache.cassandra.utils.btree
Class BTreeSet<V>
- java.lang.Object
-
- org.apache.cassandra.utils.btree.BTreeSet<V>
-
- All Implemented Interfaces:
java.lang.Iterable<V>
,java.util.Collection<V>
,java.util.List<V>
,java.util.NavigableSet<V>
,java.util.Set<V>
,java.util.SortedSet<V>
- Direct Known Subclasses:
BTreeSet.BTreeRange
public class BTreeSet<V> extends java.lang.Object implements java.util.NavigableSet<V>, java.util.List<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BTreeSet.BTreeDescRange<V>
static class
BTreeSet.BTreeRange<V>
static class
BTreeSet.Builder<V>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Comparator<? super V>
comparator
protected java.lang.Object[]
tree
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, V element)
boolean
add(V v)
boolean
addAll(int index, java.util.Collection<? extends V> c)
boolean
addAll(java.util.Collection<? extends V> c)
static <V> BTreeSet.Builder<V>
builder(java.util.Comparator<? super V> comparator)
static <V> BTreeSet.Builder<V>
builder(java.util.Comparator<? super V> comparator, int initialCapacity)
if you know the precise size of the resultant set useperfectBuilder
instead.V
ceiling(V v)
void
clear()
java.util.Comparator<? super V>
comparator()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
static <V> BTreeSet<V>
copy(java.util.SortedSet<? extends V> copy, java.util.Comparator<? super V> comparator)
static <V> BTreeSet<V>
copy(java.util.SortedSet<? extends V> copy, java.util.Comparator<? super V> comparator, java.util.function.Function<V,V> modifier)
BTreeSearchIterator<V,V>
descendingIterator()
BTreeSet<V>
descendingSet()
static <V> BTreeSet<V>
empty(java.util.Comparator<? super V> comparator)
V
first()
V
floor(V v)
V
get(int index)
The converse of indexOf: provided an index between 0 and size, returns the i'th item, in set order.int
hashCode()
java.util.SortedSet<V>
headSet(V toElement)
BTreeSet<V>
headSet(V toElement, boolean inclusive)
V
higher(V v)
int
indexOf(java.lang.Object item)
The index of the item within the list, or its insertion point otherwise.boolean
isEmpty()
BTreeSearchIterator<V,V>
iterator()
V
last()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<V>
listIterator()
java.util.ListIterator<V>
listIterator(int index)
V
lower(V v)
static <V extends java.lang.Comparable<V>>
BTreeSet<V>of(java.util.Collection<V> sortedValues)
static <V> BTreeSet<V>
of(java.util.Comparator<? super V> comparator, V value)
static <V extends java.lang.Comparable<V>>
BTreeSet<V>of(V value)
V
pollFirst()
V
pollLast()
V
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
V
set(int index, V element)
int
size()
protected BTreeSearchIterator<V,V>
slice(BTree.Dir dir)
java.util.Spliterator<V>
spliterator()
BTreeSet<V>
subList(int fromIndex, int toIndex)
BTreeSet<V>
subSet(V fromElement, boolean fromInclusive, V toElement, boolean toInclusive)
java.util.SortedSet<V>
subSet(V fromElement, V toElement)
java.util.SortedSet<V>
tailSet(V fromElement)
BTreeSet<V>
tailSet(V fromElement, boolean inclusive)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
<T> T[]
toArray(T[] a, int offset)
java.lang.Object[]
tree()
static <V> BTreeSet<V>
wrap(java.lang.Object[] btree, java.util.Comparator<? super V> comparator)
-
-
-
Field Detail
-
comparator
protected final java.util.Comparator<? super V> comparator
-
tree
protected final java.lang.Object[] tree
-
-
Constructor Detail
-
BTreeSet
public BTreeSet(java.lang.Object[] tree, java.util.Comparator<? super V> comparator)
-
-
Method Detail
-
comparator
public java.util.Comparator<? super V> comparator()
- Specified by:
comparator
in interfacejava.util.SortedSet<V>
-
slice
protected BTreeSearchIterator<V,V> slice(BTree.Dir dir)
-
tree
public java.lang.Object[] tree()
-
indexOf
public int indexOf(java.lang.Object item)
The index of the item within the list, or its insertion point otherwise. i.e. binarySearch semantics- Specified by:
indexOf
in interfacejava.util.List<V>
-
get
public V get(int index)
The converse of indexOf: provided an index between 0 and size, returns the i'th item, in set order.- Specified by:
get
in interfacejava.util.List<V>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<V>
-
subList
public BTreeSet<V> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<V>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
iterator
public BTreeSearchIterator<V,V> iterator()
-
descendingIterator
public BTreeSearchIterator<V,V> descendingIterator()
- Specified by:
descendingIterator
in interfacejava.util.NavigableSet<V>
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
toArray
public <T> T[] toArray(T[] a, int offset)
-
spliterator
public java.util.Spliterator<V> spliterator()
-
subSet
public BTreeSet<V> subSet(V fromElement, boolean fromInclusive, V toElement, boolean toInclusive)
- Specified by:
subSet
in interfacejava.util.NavigableSet<V>
-
headSet
public BTreeSet<V> headSet(V toElement, boolean inclusive)
- Specified by:
headSet
in interfacejava.util.NavigableSet<V>
-
tailSet
public BTreeSet<V> tailSet(V fromElement, boolean inclusive)
- Specified by:
tailSet
in interfacejava.util.NavigableSet<V>
-
descendingSet
public BTreeSet<V> descendingSet()
- Specified by:
descendingSet
in interfacejava.util.NavigableSet<V>
-
contains
public boolean contains(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
hashCode
public int hashCode()
-
addAll
public boolean addAll(java.util.Collection<? extends V> c)
-
addAll
public boolean addAll(int index, java.util.Collection<? extends V> c)
- Specified by:
addAll
in interfacejava.util.List<V>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
clear
public void clear()
-
add
public boolean add(V v)
-
remove
public boolean remove(java.lang.Object o)
-
listIterator
public java.util.ListIterator<V> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<V>
-
listIterator
public java.util.ListIterator<V> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<V>
-
builder
public static <V> BTreeSet.Builder<V> builder(java.util.Comparator<? super V> comparator)
-
builder
public static <V> BTreeSet.Builder<V> builder(java.util.Comparator<? super V> comparator, int initialCapacity)
if you know the precise size of the resultant set useperfectBuilder
instead.
-
wrap
public static <V> BTreeSet<V> wrap(java.lang.Object[] btree, java.util.Comparator<? super V> comparator)
-
of
public static <V extends java.lang.Comparable<V>> BTreeSet<V> of(java.util.Collection<V> sortedValues)
-
of
public static <V extends java.lang.Comparable<V>> BTreeSet<V> of(V value)
-
empty
public static <V> BTreeSet<V> empty(java.util.Comparator<? super V> comparator)
-
of
public static <V> BTreeSet<V> of(java.util.Comparator<? super V> comparator, V value)
-
copy
public static <V> BTreeSet<V> copy(java.util.SortedSet<? extends V> copy, java.util.Comparator<? super V> comparator)
-
copy
public static <V> BTreeSet<V> copy(java.util.SortedSet<? extends V> copy, java.util.Comparator<? super V> comparator, java.util.function.Function<V,V> modifier)
-
-