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 classBTreeSet.BTreeDescRange<V>static classBTreeSet.BTreeRange<V>static classBTreeSet.Builder<V>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Comparator<? super V>comparatorprotected java.lang.Object[]tree
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, V element)booleanadd(V v)booleanaddAll(int index, java.util.Collection<? extends V> c)booleanaddAll(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 useperfectBuilderinstead.Vceiling(V v)voidclear()java.util.Comparator<? super V>comparator()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)static <V> BTreeSet<V>copy(java.util.SortedSet<? extends V> copy, java.util.Comparator<? super V> comparator)BTreeSearchIterator<V,V>descendingIterator()BTreeSet<V>descendingSet()static <V> BTreeSet<V>empty(java.util.Comparator<? super V> comparator)Vfirst()Vfloor(V v)Vget(int index)The converse of indexOf: provided an index between 0 and size, returns the i'th item, in set order.inthashCode()java.util.SortedSet<V>headSet(V toElement)BTreeSet<V>headSet(V toElement, boolean inclusive)Vhigher(V v)intindexOf(java.lang.Object item)The index of the item within the list, or its insertion point otherwise.booleanisEmpty()BTreeSearchIterator<V,V>iterator()Vlast()intlastIndexOf(java.lang.Object o)java.util.ListIterator<V>listIterator()java.util.ListIterator<V>listIterator(int index)Vlower(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)VpollFirst()VpollLast()Vremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)Vset(int index, V element)intsize()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:
comparatorin 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:
indexOfin 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:
getin interfacejava.util.List<V>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List<V>
-
subList
public BTreeSet<V> subList(int fromIndex, int toIndex)
- Specified by:
subListin 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:
descendingIteratorin 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:
subSetin interfacejava.util.NavigableSet<V>
-
headSet
public BTreeSet<V> headSet(V toElement, boolean inclusive)
- Specified by:
headSetin interfacejava.util.NavigableSet<V>
-
tailSet
public BTreeSet<V> tailSet(V fromElement, boolean inclusive)
- Specified by:
tailSetin interfacejava.util.NavigableSet<V>
-
descendingSet
public BTreeSet<V> descendingSet()
- Specified by:
descendingSetin 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:
addAllin 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:
listIteratorin interfacejava.util.List<V>
-
listIterator
public java.util.ListIterator<V> listIterator(int index)
- Specified by:
listIteratorin 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 useperfectBuilderinstead.
-
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)
-
-