Package org.tinspin.index.critbit
Class CritBit64<V>
- java.lang.Object
-
- org.tinspin.index.critbit.CritBit64<V>
-
- All Implemented Interfaces:
Iterable<V>
- Direct Known Subclasses:
CritBit64COW
public class CritBit64<V> extends Object implements Iterable<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCritBit64.AtomicInfo<V>static classCritBit64.CBIterator<V>static classCritBit64.Entry<V>protected static classCritBit64.Node<V>static classCritBit64.QueryIterator<V>static classCritBit64.QueryIteratorMask<V>
-
Field Summary
Fields Modifier and Type Field Description protected static intDEPTHprotected CritBit64.AtomicInfo<V>info
-
Constructor Summary
Constructors Modifier Constructor Description protectedCritBit64()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckTree()booleancontains(long key)Check whether a given key exists in the tree.static <V> CritBit64<V>create()Create a 1D crit-bit tree with 64 bit key length.Vget(long key)Get the value for a given key.CritBit64.CBIterator<V>iterator()voidprintTree()Vput(long key, V val)Add a key value pair to the tree or replace the value if the key already exists.CritBit64.QueryIterator<V>query(long min, long max)Queries the tree for entries withmin<=key<=max.CritBit64.QueryIteratorMask<V>queryWithMask(long min, long max)Queries the tree for entries withmin<=key<=max.Vremove(long key)Remove a key and its valueintsize()Get the size of the tree.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
DEPTH
protected static final int DEPTH
- See Also:
- Constant Field Values
-
info
protected CritBit64.AtomicInfo<V> info
-
-
Method Detail
-
create
public static <V> CritBit64<V> create()
Create a 1D crit-bit tree with 64 bit key length.- Type Parameters:
V- value type- Returns:
- a 1D crit-bit tree
-
put
public V put(long key, V val)
Add a key value pair to the tree or replace the value if the key already exists.- Parameters:
key- keyval- value- Returns:
- The previous value or
nullif there was no previous value
-
printTree
public void printTree()
-
checkTree
public boolean checkTree()
-
size
public int size()
Get the size of the tree.- Returns:
- the number of keys in the tree
-
contains
public boolean contains(long key)
Check whether a given key exists in the tree.- Parameters:
key- key- Returns:
trueif the key exists otherwisefalse
-
get
public V get(long key)
Get the value for a given key.- Parameters:
key- key- Returns:
- the values associated with
keyornullif the key does not exist.
-
remove
public V remove(long key)
Remove a key and its value- Parameters:
key- key- Returns:
- The value of the key of
nullif the value was not found.
-
iterator
public CritBit64.CBIterator<V> iterator()
-
query
public CritBit64.QueryIterator<V> query(long min, long max)
Queries the tree for entries withmin<=key<=max.- Parameters:
min- minimum keymax- maximum key- Returns:
- An iterator over the matching entries.
-
queryWithMask
public CritBit64.QueryIteratorMask<V> queryWithMask(long min, long max)
Queries the tree for entries withmin<=key<=max. Unlike the normal query, this query also excludes all elements with(key|min)!=keyand(key&max!=max). See PH-Tree for a discussion.- Parameters:
min- minimum keymax- maximum key- Returns:
- An iterator over the matching entries.
-
-