org.neodatis.btree.impl
Class AbstractBTree
java.lang.Object
org.neodatis.btree.impl.AbstractBTree
- All Implemented Interfaces:
- java.io.Serializable, IBTree
- Direct Known Subclasses:
- BTreeMultipleValuesPerKey, BTreeSingleValuePerKey, InMemoryBTreeMultipleValuesPerKey, InMemoryBTreeSingleValuePerKey
public abstract class AbstractBTree
- extends java.lang.Object
- implements IBTree
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
persister
protected transient IBTreePersister persister
controlNumber
protected int controlNumber
AbstractBTree
public AbstractBTree()
AbstractBTree
public AbstractBTree(java.lang.String name,
int degree,
IBTreePersister persister)
buildNode
public abstract IBTreeNode buildNode()
- Specified by:
buildNode
in interface IBTree
delete
public java.lang.Object delete(java.lang.Comparable key,
java.lang.Object value)
- TODO Manage collision
- Specified by:
delete
in interface IBTree
internalDelete
protected java.lang.Object internalDelete(IBTreeNode node,
IKeyAndValue keyAndValue)
throws java.lang.Exception
- Returns the value of the deleted key
- Parameters:
node
- keyAndValue
-
- Returns:
-
- Throws:
java.lang.Exception
getDegree
public int getDegree()
- Specified by:
getDegree
in interface IBTree
insert
public void insert(java.lang.Comparable key,
java.lang.Object value)
- Specified by:
insert
in interface IBTree
split
public void split(IBTreeNode parent,
IBTreeNode node2Split,
int childIndex)
1 take median element
2 insert the median in the parent (shifting necessary elements)
3 create a new node with right part elements (moving keys and values and children)
4 set this new node as a child of parent
- Specified by:
split
in interface IBTree
getSize
public long getSize()
- Specified by:
getSize
in interface IBTree
getRoot
public IBTreeNode getRoot()
- Specified by:
getRoot
in interface IBTree
getHeight
public int getHeight()
- Specified by:
getHeight
in interface IBTree
getPersister
public IBTreePersister getPersister()
- Specified by:
getPersister
in interface IBTree
setPersister
public void setPersister(IBTreePersister persister)
- Specified by:
setPersister
in interface IBTree
getName
public java.lang.String getName()
clear
public void clear()
- Specified by:
clear
in interface IBTree
getBiggest
public IKeyAndValue getBiggest(IBTreeNode node,
boolean delete)
- Specified by:
getBiggest
in interface IBTree
getSmallest
public IKeyAndValue getSmallest(IBTreeNode node,
boolean delete)
- Specified by:
getSmallest
in interface IBTree