public class BTree
extends java.lang.Object
| Constructor and Description |
|---|
BTree() |
| Modifier and Type | Method and Description |
|---|---|
static <V> java.lang.Object[] |
build(java.util.Collection<V> source,
java.util.Comparator<V> comparator,
boolean sorted,
UpdateFunction<V> updateF) |
static <V> java.lang.Object[] |
build(java.lang.Iterable<V> source,
int size,
java.util.Comparator<V> comparator,
boolean sorted,
UpdateFunction<V> updateF)
Creates a BTree containing all of the objects in the provided collection
|
static int |
depth(java.lang.Object[] tree) |
static java.lang.Object[] |
empty()
Returns an empty BTree
|
static <V> V |
find(java.lang.Object[] node,
java.util.Comparator<V> comparator,
V find) |
static boolean |
isEmpty(java.lang.Object[] tree) |
static boolean |
isWellFormed(java.lang.Object[] btree,
java.util.Comparator<? extends java.lang.Object> cmp) |
static <V> Cursor<V,V> |
slice(java.lang.Object[] btree,
boolean forwards)
Returns an Iterator over the entire tree
|
static <K,V extends K> |
slice(java.lang.Object[] btree,
java.util.Comparator<K> comparator,
K start,
boolean startInclusive,
K end,
boolean endInclusive,
boolean forwards)
Returns an Iterator over a sub-range of the tree
|
static <K,V extends K> |
slice(java.lang.Object[] btree,
java.util.Comparator<K> comparator,
K start,
K end,
boolean forwards)
Returns an Iterator over a sub-range of the tree
|
static <V> java.lang.Object[] |
update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.util.Collection<V> updateWith,
boolean updateWithIsSorted)
Returns a new BTree with the provided set inserting/replacing as necessary any equal items
|
static <V> java.lang.Object[] |
update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.util.Collection<V> updateWith,
boolean updateWithIsSorted,
UpdateFunction<V> updateF) |
static <V> java.lang.Object[] |
update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.lang.Iterable<V> updateWith,
int updateWithLength,
boolean updateWithIsSorted,
UpdateFunction<V> updateF)
Returns a new BTree with the provided set inserting/replacing as necessary any equal items
|
public static java.lang.Object[] empty()
public static <V> java.lang.Object[] build(java.util.Collection<V> source,
java.util.Comparator<V> comparator,
boolean sorted,
UpdateFunction<V> updateF)
public static <V> java.lang.Object[] build(java.lang.Iterable<V> source,
int size,
java.util.Comparator<V> comparator,
boolean sorted,
UpdateFunction<V> updateF)
V - source - the items to build the tree withcomparator - the comparator that defines the ordering over the items in the treesorted - if false, the collection will be copied and sorted to facilitate constructionpublic static <V> java.lang.Object[] update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.util.Collection<V> updateWith,
boolean updateWithIsSorted)
V - btree - the tree to updatecomparator - the comparator that defines the ordering over the items in the treeupdateWith - the items to either insert / updateupdateWithIsSorted - if false, updateWith will be copied and sorted to facilitate constructionpublic static <V> java.lang.Object[] update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.util.Collection<V> updateWith,
boolean updateWithIsSorted,
UpdateFunction<V> updateF)
public static <V> java.lang.Object[] update(java.lang.Object[] btree,
java.util.Comparator<V> comparator,
java.lang.Iterable<V> updateWith,
int updateWithLength,
boolean updateWithIsSorted,
UpdateFunction<V> updateF)
V - btree - the tree to updatecomparator - the comparator that defines the ordering over the items in the treeupdateWith - the items to either insert / updateupdateWithIsSorted - if false, updateWith will be copied and sorted to facilitate constructionupdateF - the update function to apply to any pairs we are swapping, and maybe abort earlypublic static <V> Cursor<V,V> slice(java.lang.Object[] btree, boolean forwards)
V - btree - the tree to iterate overforwards - if false, the iterator will start at the end and move backwardspublic static <K,V extends K> Cursor<K,V> slice(java.lang.Object[] btree, java.util.Comparator<K> comparator, K start, K end, boolean forwards)
V - btree - the tree to iterate overcomparator - the comparator that defines the ordering over the items in the treestart - the first item to includeend - the last item to includeforwards - if false, the iterator will start at end and move backwardspublic static <K,V extends K> Cursor<K,V> slice(java.lang.Object[] btree, java.util.Comparator<K> comparator, K start, boolean startInclusive, K end, boolean endInclusive, boolean forwards)
V - btree - the tree to iterate overcomparator - the comparator that defines the ordering over the items in the treestart - the first item to includeend - the last item to includeforwards - if false, the iterator will start at end and move backwardspublic static <V> V find(java.lang.Object[] node,
java.util.Comparator<V> comparator,
V find)
public static boolean isEmpty(java.lang.Object[] tree)
public static int depth(java.lang.Object[] tree)
public static boolean isWellFormed(java.lang.Object[] btree,
java.util.Comparator<? extends java.lang.Object> cmp)
Copyright © 2018 The Apache Software Foundation