|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.graphs.BinaryTree | +--edu.berkeley.guir.lib.graphs.PathTree
A Path Tree that represents a hierarchy of siblings and children. You throw Paths into this Tree, and it builds the appropriate hierarchy tree.
The left subtree represents a sibling, and the right subtree represents a child.
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Dec 01 1997, JH Created class - GUIRLib-v1.0-1.1.0, Feb 24 2000, JH Updated for JDK1.3RC1 to use the Collections - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Fields inherited from class edu.berkeley.guir.lib.graphs.BinaryTree |
data, left, right |
Constructor Summary | |
|
PathTree()
Creates a new and empty PathTree. |
protected |
PathTree(Node node)
Creates a new PathTree. |
Method Summary | |
void |
addPath(Path p)
Adds a path into this hierarchy tree. |
protected PathTree |
child()
Get the child subtree of the current tree. |
Object |
clone()
Clones this PathTree. |
protected Node |
data()
Get the value at the root of this tree. |
boolean |
equals(Object obj)
|
int |
getNumOfHits()
Get the number of hits currently in this PathTree. |
int |
getNumOfLeaves()
Get the number of leaves currently in this PathTree. |
int |
getNumOfNodes()
Get the number of unique nodes currently in this PathTree. |
protected PathTree |
hasChild(PathTree ptree)
Sees if the specified PathTree is a child of the current node. |
protected PathTree |
hasSibling(PathTree ptree)
Sees if the specified PathTree is a sibling of the current node (or the same as the current node). |
Enumeration |
inOrderTraversal()
Perform an inorder traversal on this tree. |
Enumeration |
postOrderTraversal()
Perform a postorder traversal on this tree. |
Enumeration |
preOrderTraversal()
Perform a preorder traversal on this tree. |
void |
printReverseOrderTraversal()
Print out the traversal in reverse pre-order to the default System.out stream in a formatted order. |
void |
printReverseOrderTraversal(PrintWriter pwriter)
Print out the traversal in reverse pre-order to the specified PrintWriter in a formatted order. |
void |
printTraversal()
Print out the tree in a hierarchy to System.out, using the default layout formatter for the PathTree. |
void |
printTraversal(PathTreeFormatter f)
Print out the tree in a hierarchy to System.out, using the specified layout formatter for the PathTree. |
void |
printTraversal(PrintWriter pwriter)
Print out the tree in a hierarchy to the specified Writer, using the default PathTreeFormatter layout. |
void |
printTraversal(PrintWriter pwriter,
PathTreeFormatter f)
Print out the tree in a hierarchy to the specified Writer, using the PathTreeFormatter passed in. |
protected void |
setChild(PathTree ptree)
Set the child subtree of the current tree. |
protected void |
setData(Node node)
Set the value at the root of this tree. |
void |
setDefaultFormatter(PathTreeFormatter f)
|
protected void |
setSibling(PathTree ptree)
Set the sibling subtree of the current tree. |
protected PathTree |
sibling()
Get the sibling subtree of the current tree. |
Methods inherited from class edu.berkeley.guir.lib.graphs.BinaryTree |
_data, _left, _right, _setData, _setLeft, _setRight, add, exists, getNumberOfElements, remove, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PathTree()
protected PathTree(Node node)
Method Detail |
public void setDefaultFormatter(PathTreeFormatter f)
public void addPath(Path p)
p
- is the Path to add into this tree.protected void setChild(PathTree ptree)
ptree
- is a PathTree to set the child subtree to.protected void setSibling(PathTree ptree)
ptree
- is a PathTree to set the sibling subtree to.protected void setData(Node node)
str
- is the value for the root of this tree.public int getNumOfNodes()
public int getNumOfLeaves()
public int getNumOfHits()
protected PathTree hasChild(PathTree ptree)
ptree
- is the PathTree to check for.protected PathTree hasSibling(PathTree ptree)
ptree
- is the PathTree to check for.protected Node data()
protected PathTree child()
protected PathTree sibling()
public Enumeration inOrderTraversal()
inOrderTraversal
in class BinaryTree
public Enumeration preOrderTraversal()
preOrderTraversal
in class BinaryTree
public Enumeration postOrderTraversal()
postOrderTraversal
in class BinaryTree
public void printReverseOrderTraversal()
public void printReverseOrderTraversal(PrintWriter pwriter)
pwriter
- is the PrintWriter to print out to.public void printTraversal()
public void printTraversal(PathTreeFormatter f)
f
- is an interface to a layout formatter for PathTrees.public void printTraversal(PrintWriter pwriter)
The order of events is:
onStart()
(once only)
onStartOfNode()
onLeaf()
or onNode()
onBacktrack()
onEndOfNode()
onFinish()
(once only)
pwriter
- is the PrintWriter to print out to.public void printTraversal(PrintWriter pwriter, PathTreeFormatter f)
pwriter
- is the PrintWriter to print out to.f
- is the formatting object, that is, an interface to an object
that contains methods that can format the layout of this PathTree.public Object clone()
clone
in class Object
public boolean equals(Object obj)
equals
in class BinaryTree
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |