|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.locomotive.util.data.DataTree
this class is an abstract implementation of a data tree, and can be extended to for heaps or binary search trees. it proivides implementations for two kinds of data structures: 1. where there is a key and a data type 2. where the key is the data type All keys must implement the comparisonKey class
ComparisonKey| Inner Class Summary | |
protected class |
DataTree.TreeNode
a node for a binary search tree |
| Field Summary | |
protected int |
count
|
protected DataTree.TreeNode |
root
|
| Constructor Summary | |
DataTree()
construct an empty tree sets number of items in the tree to zero |
|
DataTree(ComparisonKey newObject)
constructs a tree with the comparisonKey as the key and the data for the root node. |
|
DataTree(ComparisonKey newKey,
java.lang.Object newData)
constructs a new tree with a key and it's data as the root |
|
DataTree(DataTree.TreeNode node)
create a tree with the node as it's root |
|
| Method Summary | |
DataTree.TreeNode |
find(ComparisonKey key)
finds the object node containing the object with the specified key and returns it. |
void |
insert(ComparisonKey newKey)
inserts a node whose comparisonKey is its data |
void |
insert(ComparisonKey newKey,
java.lang.Object newData)
inserts a new object into tree |
boolean |
isEmpty()
returns true if the tree is empty, false if otherwise |
DataTree.TreeNode |
root()
returns the root node of the tree. |
int |
size()
this method returns the number of elements in the tree |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected DataTree.TreeNode root
protected int count
| Constructor Detail |
public DataTree()
public DataTree(DataTree.TreeNode node)
node - the TreeNode to set the root as
public DataTree(ComparisonKey newKey,
java.lang.Object newData)
newKey - the ComparisonKey to place at the rootnewData - the data to place in the root nodepublic DataTree(ComparisonKey newObject)
newObject - the ComparisonKey to place at the root| Method Detail |
public void insert(ComparisonKey newKey,
java.lang.Object newData)
newKey - the key to use for the objectnewData - the ComparisonKey to enterpublic void insert(ComparisonKey newKey)
public boolean isEmpty()
public DataTree.TreeNode find(ComparisonKey key)
public DataTree.TreeNode root()
public int size()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||