| Constructor and Description |
|---|
BTreeNode(E element)
Creates a new BTreeNode with the specified element.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBalance()
Returns this node's balance.
|
E |
getElement()
Returns this node's element.
|
BTreeNode<E> |
getLeftChild()
Returns this node's leftmost child.
|
BTreeNode<E> |
getParent()
Returns this node's parent node.
|
BTreeNode<E> |
getRightChild()
Returns this node's right child.
|
void |
removeLeftChild()
Removes this node's left child.
|
void |
removeRightChild()
Removes this node's right child.
|
void |
setBalance(int balance)
Sets this node's balance.
|
E |
setElement(E element)
Sets this node's element.
|
void |
setLeftChild(BTree<E> tree)
Sets this node's left child to be the root node of the specified
BTree.
|
void |
setLeftChild(BTreeNode<E> node)
Sets this node's left child.
|
void |
setParent(fi.uef.cs.tra.TreeComponent<E> parent)
Sets this node's parent.
|
void |
setRightChild(BTree<E> tree)
Sets this node's right child to be the root node of the specified
BTree. |
void |
setRightChild(BTreeNode<E> node)
Sets this node's right child.
|
java.lang.String |
toString()
Returns (element) as String.
|
public BTreeNode(E element)
element - the element for the BTreeNode.public void setBalance(int balance)
balance - the new balance for this node.public int getBalance()
public E getElement()
public E setElement(E element)
element - new element for this node.ElementTypeMismatchException - if the type of element
does not match that of this node.public BTreeNode<E> getParent()
BTree.public void setParent(fi.uef.cs.tra.TreeComponent<E> parent)
parent - the new parent for this node.public BTreeNode<E> getLeftChild()
public void setLeftChild(BTreeNode<E> node)
node - the new left child.java.lang.NullPointerException - if node is null.ElementTypeMismatchException - if node's element type does
not match that of this node.public void setLeftChild(BTree<E> tree)
tree - the BTree the root node of which is
to be this node's left child.java.lang.NullPointerException - if tree or its root node is
null.ElementTypeMismatchException - if tree's element type does
not match that of this node.public void removeLeftChild()
public BTreeNode<E> getRightChild()
public void setRightChild(BTreeNode<E> node)
node - the new right child.java.lang.NullPointerException - if node is null.BTreeException - if this node is the root node.public void setRightChild(BTree<E> tree)
BTree.tree - the BTree the root node of which is
to become this node's right child.java.lang.NullPointerException - if tree or its root node is
null.ElementTypeMismatchException - if tree's element type does
not match that of this node.public void removeRightChild()
public java.lang.String toString()
toString in class java.lang.Object