|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.util.data.DataTree.TreeNode
a node for a binary search tree
Constructor Summary | |
DataTree.TreeNode(ComparisonKey data)
Constructor for Nodes with keys as data |
|
DataTree.TreeNode(ComparisonKey key,
java.lang.Object data)
Constructor takes a key and it's corresponding data |
Method Summary | |
int |
compare(DataTree.TreeNode node)
Convenience method for comparing the keys of two tree nodes |
java.lang.Object |
getData()
access data |
ComparisonKey |
getKey()
Access key |
DataTree.TreeNode |
getLeftChild()
|
DataTree.TreeNode |
getParent()
Access parent |
DataTree.TreeNode |
getRightChild()
|
boolean |
hasNoChildren()
returns true if node has no children |
boolean |
leafNode()
returns true if node is a leaf node (if node has < 2 children) |
java.lang.Object |
returnData()
returns the data contained in the node: either node.data or node.key if node.data is null |
void |
setData(java.lang.Object newData)
Change data |
void |
setKey(ComparisonKey newKey)
Change key |
void |
setLeftChild(DataTree.TreeNode newChild)
Set left child of this node and parent pointer of new left child. |
void |
setRightChild(DataTree.TreeNode newChild)
Set right child of this node and parent pointer of new right child. |
void |
swapData(DataTree.TreeNode node)
Swap data with another node |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public DataTree.TreeNode(ComparisonKey key, java.lang.Object data)
public DataTree.TreeNode(ComparisonKey data)
Method Detail |
public int compare(DataTree.TreeNode node) throws ComparisonKeyException
public ComparisonKey getKey()
public java.lang.Object getData()
public DataTree.TreeNode getParent()
public DataTree.TreeNode getLeftChild()
public DataTree.TreeNode getRightChild()
public boolean hasNoChildren()
public boolean leafNode()
public java.lang.Object returnData()
public void setKey(ComparisonKey newKey)
public void setData(java.lang.Object newData)
public void swapData(DataTree.TreeNode node)
public void setLeftChild(DataTree.TreeNode newChild)
public void setRightChild(DataTree.TreeNode newChild)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |