org.neodatis.btree.impl
Class AbstractBTreeNode
- java.lang.Object
-
- org.neodatis.btree.impl.AbstractBTreeNode
-
- All Implemented Interfaces:
- java.io.Serializable, IBTreeNode
- Direct Known Subclasses:
- BTreeNodeMultipleValuesPerKey, BTreeNodeSingleValuePerKey
public abstract class AbstractBTreeNode extends java.lang.Object implements IBTreeNode
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractBTreeNode()AbstractBTreeNode(IBTree btree)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidclear()java.lang.ObjectdeleteKeyAndValueAt(int keyIndex, boolean shiftChildren)java.lang.ObjectdeleteKeyForLeafNode(IKeyAndValue keyAndValue)IBTreeNodeextractRightPart()Creates a new node with the right part of this node.IBTreegetBTree()abstract IBTreeNodegetChildAt(int index, boolean throwExceptionIfNotExist)intgetDegree()IKeyAndValuegetKeyAndValueAt(int index)java.lang.ComparablegetKeyAt(int index)IBTreeNodegetLastChild()IKeyAndValuegetLastKeyAndValue()IBTreeNodegetLastPositionChild()intgetMaxNbChildren()IKeyAndValuegetMedian()intgetNbChildren()intgetNbKeys()abstract IBTreeNodegetParent()abstract java.lang.ObjectgetParentId()intgetPositionOfKey(java.lang.Comparable key)Returns the position of the key.abstract booleanhasParent()voidincrementNbChildren()voidincrementNbKeys()abstract voidinsertKeyAndValue(java.lang.Comparable key, java.lang.Object value)booleanisFull()booleanisLeaf()voidmergeWith(IBTreeNode node)Can only merge node without intersection => the greater key of this must be smaller than the smallest key of the nodeabstract voidmoveChildFromTo(int sourceIndex, int destinationIndex, boolean throwExceptionIfDoesNotExist)voidremoveKeyAndValueAt(int index)voidsetBTree(IBTree btree)voidsetKeyAndValueAt(java.lang.Comparable key, java.lang.Object value, int index)voidsetKeyAndValueAt(java.lang.Comparable key, java.lang.Object value, int index, boolean shiftIfAlreadyExist, boolean incrementNbKeys)voidsetKeyAndValueAt(IKeyAndValue keyAndValue, int index)voidsetKeyAndValueAt(IKeyAndValue keyAndValue, int index, boolean shiftIfAlreadyExist, boolean incrementNbKeys)voidsetNbChildren(int nbChildren)voidsetNbKeys(int nbKeys)abstract voidsetParent(IBTreeNode node)java.lang.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.neodatis.btree.IBTreeNode
deleteChildAt, getChildIdAt, getId, getValueAsObjectAt, setChildAt, setChildAt, setId, setNullChildAt
-
-
-
-
Constructor Detail
-
AbstractBTreeNode
public AbstractBTreeNode()
-
AbstractBTreeNode
public AbstractBTreeNode(IBTree btree)
-
-
Method Detail
-
insertKeyAndValue
public abstract void insertKeyAndValue(java.lang.Comparable key, java.lang.Object value)- Specified by:
insertKeyAndValuein interfaceIBTreeNode
-
getChildAt
public abstract IBTreeNode getChildAt(int index, boolean throwExceptionIfNotExist)
- Specified by:
getChildAtin interfaceIBTreeNode
-
getParent
public abstract IBTreeNode getParent()
- Specified by:
getParentin interfaceIBTreeNode
-
getParentId
public abstract java.lang.Object getParentId()
- Specified by:
getParentIdin interfaceIBTreeNode
-
setParent
public abstract void setParent(IBTreeNode node)
- Specified by:
setParentin interfaceIBTreeNode
-
hasParent
public abstract boolean hasParent()
- Specified by:
hasParentin interfaceIBTreeNode
-
moveChildFromTo
public abstract void moveChildFromTo(int sourceIndex, int destinationIndex, boolean throwExceptionIfDoesNotExist)- Specified by:
moveChildFromToin interfaceIBTreeNode
-
extractRightPart
public IBTreeNode extractRightPart()
Creates a new node with the right part of this node. This should only be called on a full node- Specified by:
extractRightPartin interfaceIBTreeNode
-
getKeyAndValueAt
public IKeyAndValue getKeyAndValueAt(int index)
- Specified by:
getKeyAndValueAtin interfaceIBTreeNode
-
getLastKeyAndValue
public IKeyAndValue getLastKeyAndValue()
- Specified by:
getLastKeyAndValuein interfaceIBTreeNode
-
getKeyAt
public java.lang.Comparable getKeyAt(int index)
- Specified by:
getKeyAtin interfaceIBTreeNode
-
getMedian
public IKeyAndValue getMedian()
- Specified by:
getMedianin interfaceIBTreeNode
-
getPositionOfKey
public int getPositionOfKey(java.lang.Comparable key)
Returns the position of the key. If the key does not exist in node, returns the position where this key should be,multiplied by -1for example for node of degree 3 : [1 89 452 789 - ], calling getPositionOfKey(89) returns 2 (starts with 1) calling getPositionOfKey(99) returns -2 (starts with 1),because the position should be done, but it does not exist so multiply by -1 this is used to know the child we should descend to!in this case the getChild(2).
- Specified by:
getPositionOfKeyin interfaceIBTreeNode- Parameters:
key-- Returns:
- The position of the key,as a negative number if key does not exist, warning, the position starts with 1and not 0!
-
incrementNbChildren
public void incrementNbChildren()
- Specified by:
incrementNbChildrenin interfaceIBTreeNode
-
incrementNbKeys
public void incrementNbKeys()
- Specified by:
incrementNbKeysin interfaceIBTreeNode
-
setKeyAndValueAt
public void setKeyAndValueAt(java.lang.Comparable key, java.lang.Object value, int index)- Specified by:
setKeyAndValueAtin interfaceIBTreeNode
-
setKeyAndValueAt
public void setKeyAndValueAt(IKeyAndValue keyAndValue, int index)
- Specified by:
setKeyAndValueAtin interfaceIBTreeNode
-
setKeyAndValueAt
public void setKeyAndValueAt(java.lang.Comparable key, java.lang.Object value, int index, boolean shiftIfAlreadyExist, boolean incrementNbKeys)- Specified by:
setKeyAndValueAtin interfaceIBTreeNode
-
setKeyAndValueAt
public void setKeyAndValueAt(IKeyAndValue keyAndValue, int index, boolean shiftIfAlreadyExist, boolean incrementNbKeys)
- Specified by:
setKeyAndValueAtin interfaceIBTreeNode
-
isFull
public boolean isFull()
- Specified by:
isFullin interfaceIBTreeNode
-
isLeaf
public boolean isLeaf()
- Specified by:
isLeafin interfaceIBTreeNode
-
mergeWith
public void mergeWith(IBTreeNode node)
Can only merge node without intersection => the greater key of this must be smaller than the smallest key of the node- Specified by:
mergeWithin interfaceIBTreeNode
-
removeKeyAndValueAt
public void removeKeyAndValueAt(int index)
- Specified by:
removeKeyAndValueAtin interfaceIBTreeNode
-
getLastChild
public IBTreeNode getLastChild()
- Specified by:
getLastChildin interfaceIBTreeNode
-
getLastPositionChild
public IBTreeNode getLastPositionChild()
- Specified by:
getLastPositionChildin interfaceIBTreeNode
-
getNbKeys
public int getNbKeys()
- Specified by:
getNbKeysin interfaceIBTreeNode
-
setNbChildren
public void setNbChildren(int nbChildren)
- Specified by:
setNbChildrenin interfaceIBTreeNode
-
setNbKeys
public void setNbKeys(int nbKeys)
- Specified by:
setNbKeysin interfaceIBTreeNode
-
getDegree
public int getDegree()
- Specified by:
getDegreein interfaceIBTreeNode
-
getNbChildren
public int getNbChildren()
- Specified by:
getNbChildrenin interfaceIBTreeNode
-
deleteKeyForLeafNode
public java.lang.Object deleteKeyForLeafNode(IKeyAndValue keyAndValue)
- Specified by:
deleteKeyForLeafNodein interfaceIBTreeNode
-
deleteKeyAndValueAt
public java.lang.Object deleteKeyAndValueAt(int keyIndex, boolean shiftChildren)- Specified by:
deleteKeyAndValueAtin interfaceIBTreeNode
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMaxNbChildren
public int getMaxNbChildren()
- Specified by:
getMaxNbChildrenin interfaceIBTreeNode
-
setBTree
public void setBTree(IBTree btree)
- Specified by:
setBTreein interfaceIBTreeNode
-
getBTree
public IBTree getBTree()
- Specified by:
getBTreein interfaceIBTreeNode
-
clear
public void clear()
- Specified by:
clearin interfaceIBTreeNode
-
-
DataMelt 3.0 © DataMelt by jWork.ORG