Class WNode

java.lang.Object
   |
   +----WNode

public class WNode
extends Object
Represents a node (or tree) in the WalTree. This is part of the WalTree package, created by Walter Korman to enable the visually appealing display of M-ary trees. More documentation is available at his web site; follow the link below to get to it.

Documentation

Added by Naomi Novik:
The boolean field "visited" and the "visit" and "leave" methods were added for use in displaying a search as it progresses through a tree. The methods expand(), getNodeDepth(), and getTreeDepth() were added to help with searching functions, so that calling classes don't need to know what the member fields of the WNode are. The toString() method was added for the same reason.

Author:
Walter Korman, Naomi Novik

Constructor Index

 o WNode(String, WNode, WNode, WNode, int, int, int)

Method Index

 o expand()
Expand a node, returning a Vector containing its children.
 o getNodeDepth()
Determine depth of node within the tree.
 o getTreeDepth()
Determine maximum depth of tree rooted at this node.
 o leave()
Change the visited status of the node to false.
 o toString()
Return the label of the node.
 o visit()
Change the visited status of the node to true.

Constructors

 o WNode
 public WNode(String l,
              WNode p,
              WNode c,
              WNode s,
              int w,
              int h,
              int b)

Methods

 o toString
 public String toString()
Return the label of the node.

Overrides:
toString in class Object
 o visit
 public void visit()
Change the visited status of the node to true.

 o leave
 public void leave()
Change the visited status of the node to false.

 o expand
 public Vector expand()
Expand a node, returning a Vector containing its children.

 o getNodeDepth
 public int getNodeDepth()
Determine depth of node within the tree. The number of parents the node has represents its depth, assuming the root has depth 0.

 o getTreeDepth
 public int getTreeDepth()
Determine maximum depth of tree rooted at this node. Assuming an even distribution, this is until there are no more children in a straight line from the root.