|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.joensuu.cs.tra.TreeNode<E>
public class TreeNode<E>
TreeNode is a building block for basic
Tree
s.
Tree
Constructor Summary | |
---|---|
TreeNode(E element)
Creates a new TreeNode with the specified element. |
Method Summary | |
---|---|
int |
getBalance()
Returns this node's balance. |
E |
getElement()
Returns this node's element. |
TreeNode<E> |
getLeftChild()
Returns this node's leftmost child. |
TreeNode<E> |
getParent()
Returns this node's parent node. |
TreeNode<E> |
getRightSibling()
Returns this node's right sibling. |
TreeNode<E> |
removeLeftChild()
Removes this node's left child. |
TreeNode<E> |
removeRightSibling()
Removes this node's right sibling. |
void |
setBalance(int balance)
Sets this node's balance. |
E |
setElement(E element)
Sets this node's element. |
void |
setLeftChild(Tree<E> tree)
Sets this node's left child to be the root node of the specified Tree. |
void |
setLeftChild(TreeNode<E> node)
Sets this node's left child. |
void |
setRightSibling(Tree<E> tree)
Sets this node's right sibling to be the root node of the specified Tree . |
void |
setRightSibling(TreeNode<E> node)
Sets this node's right sibling. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeNode(E element)
element
- the element for the TreeNode.Method Detail |
---|
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 TreeNode<E> getParent()
Tree
.public TreeNode<E> getLeftChild()
public void setLeftChild(TreeNode<E> node)
node
- the new left child.
NullPointerException
- if node is null.
ElementTypeMismatchException
- if node's element type does
not match that of this node.public void setLeftChild(Tree<E> tree)
tree
- the Tree
the root node of which is
to be this node's left child.
NullPointerException
- if tree or its root node is
null.
ElementTypeMismatchException
- if tree's element type does
not match that of this node.public TreeNode<E> removeLeftChild()
public TreeNode<E> getRightSibling()
public void setRightSibling(TreeNode<E> node)
node
- the new right sibling.
NullPointerException
- if node is null.
TreeException
- if this node is the root node.public void setRightSibling(Tree<E> tree)
Tree
.
tree
- the Tree
the root node of which is
to become this node's right sibling.
NullPointerException
- if tree or its root node is
null.
ElementTypeMismatchException
- if tree's element type does
not match that of this node.public TreeNode<E> removeRightSibling()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |