|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object BinaryTreeBasis<T> BinaryTree<T>
public class BinaryTree<T>
Constructor Summary | |
---|---|
BinaryTree()
The default constructor for BinaryTree initializes the
BinaryTree to be empty. |
|
BinaryTree(T rootItem)
This constructor for BinaryTree initializes the BinaryTree to
have a root containing the specified data item. |
|
BinaryTree(T rootItem,
BinaryTree<T> leftTree,
BinaryTree<T> rightTree)
This constructor for BinaryTree initializes the BinaryTree to
have a root containing the specified data item. |
Method Summary | |
---|---|
void |
setRootItem(T newItem)
This method will place the specified data item in the root node of this BinaryTree. |
Methods inherited from class BinaryTreeBasis |
---|
getRoot, getRootItem, isEmpty, makeEmpty, setRoot |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryTree()
BinaryTree
initializes the
BinaryTree
to be empty.
public BinaryTree(T rootItem)
BinaryTree
initializes the BinaryTree
to
have a root containing the specified data item.
rootItem
- The data item that will be contained by the root of this BinaryTree
public BinaryTree(T rootItem, BinaryTree<T> leftTree, BinaryTree<T> rightTree)
BinaryTree
initializes the BinaryTree
to
have a root containing the specified data item. This constructor also initializes
the left subtree and right subtree of the root to the specified parameters.
rootItem
- The data item that will be contained by the root of this BinaryTreeleftTree
- The left subtree of the rootrightTree
- The right subtree of the root
Method Detail |
---|
public void setRootItem(T newItem)
BinaryTree. If the
BinaryTree already has a root node, its data item is updated. If the BinaryTree
does not have a root node, a new root is created and it will contain the specified data item.
- Specified by:
setRootItem
in class BinaryTreeBasis<T>
- Parameters:
newItem
- The data item that will be contained by the root of this BinaryTree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |