|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectFlexOr.container.BinaryTree
FlexOr.container.OrderedBinaryTree
public class OrderedBinaryTree
| Constructor Summary | |
|---|---|
OrderedBinaryTree(BinaryPredicate orderComparison,
BinaryPredicate equalComparison)
Define an empty binary tree. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Object obj)
Adds obj at the leaf level such thatcomparison.execute(obj, node.datum) = true means go down the left subtree else go down the right subtree. |
java.lang.Object |
clone()
Return a copy of the container that points to the same objects as in the original container. |
boolean |
contains(java.lang.Object obj)
Determines whether an element is in the tree. |
boolean |
remove(java.lang.Object obj)
Remove the specified element. |
| Methods inherited from class FlexOr.container.BinaryTree |
|---|
elements, equals, inOrderLRtraversal, inOrderRLtraversal, isEmpty, isFull, levelOrderLRtraversal, levelOrderRLtraversal, postOrderLRtraversal, postOrderRLtraversal, preOrderLRtraversal, preOrderRLtraversal, remove, removeAll, size, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public OrderedBinaryTree(BinaryPredicate orderComparison,
BinaryPredicate equalComparison)
orderComparison - defines how nodes are compared when
deciding which branch to take.equalComparison - defines how nodes
are checked for equality.| Method Detail |
|---|
public void add(java.lang.Object obj)
obj at the leaf level such thatobj is already in the
tree based upon equalTo (which could be partiol equality) then datum is
replaced with obj.
Requires: True
Ensures: contains(obj) = true
old contains(obj) = false => size = old size + 1
old contains(obj) = true => size = old size
add in interface Containeradd in class BinaryTreepublic boolean remove(java.lang.Object obj)
Requires: size >= 0
Ensures:
old binaryTree.contains(obj) =>
binaryTree = old binaryTree / obj and result = true
not old binaryTree.contains(obj) =>
binaryTree = old binaryTree and result = false
remove in class BinaryTreeContainerEmptyException - when removing from an empty container.public boolean contains(java.lang.Object obj)
Requires: True
Ensures: contains(obj) => result = true
not contains(obj) => result = false
contains in interface Containercontains in class BinaryTreepublic java.lang.Object clone()
Requires: True Ensures: result = copy of BinaryTree
clone in interface Containerclone in class BinaryTree
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||