|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.melati.util.Tree
public class Tree
A whole tree.
| Constructor Summary | |
|---|---|
Tree(Treeable node)
Constructor from root node. |
|
Tree(Treeable[] nodes)
Constructor for a multi-rooted tree. |
|
Tree(Treeable[] nodes,
int depth)
Constructor for a multi-rooted tree with anticipated depth. |
|
Tree(Treeable node,
int depth)
Constructor from root node with anticipated depth. |
|
| Method Summary | |
|---|---|
Vector<TreeNode> |
apply(Function func,
int depthP,
boolean depthFirst)
Apply the Function to each node in the tree. |
Vector<TreeNode> |
applyBreadthFirst(Function func)
Apply a function to all nodes, breadth first. |
Vector<TreeNode> |
applyBreadthFirst(Function func,
int depthP)
Apply a function to all nodes to a given depth, breadth first. |
Vector<TreeNode> |
applyDepthFirst(Function func)
Apply a function to all nodes, depth first. |
Vector<TreeNode> |
applyDepthFirst(Function func,
int depthP)
Apply a function to all nodes to a given depth, depth first. |
Vector<TreeNode> |
flattened()
|
Vector<TreeNode> |
flattened(int depthP)
Retrieve all the nodes down to a given depth, depth-first. |
Vector<TreeNode> |
flattened(int depthP,
boolean depthFirst)
Retrieve all the nodes down to a given depth. |
int |
getDepth()
|
Treeable[] |
getTreeableRoots()
|
Vector<TreeNode> |
sorted(Order cmp,
int depthP)
Retrieve a sorted Vector of the tree's contents, down to the given depth. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Tree(Treeable node)
node - root node
public Tree(Treeable node,
int depth)
node - root nodedepth - the anticipated depthpublic Tree(Treeable[] nodes)
nodes - the root nodes
public Tree(Treeable[] nodes,
int depth)
nodes - the root nodesdepth - anticipated depth| Method Detail |
|---|
public Treeable[] getTreeableRoots()
public int getDepth()
public Vector<TreeNode> flattened(int depthP,
boolean depthFirst)
depthP - Only apply the function to nodes at or above this depth. A negative
depth means apply this to all nodes in the treedepthFirst - If true, traverse the tree depth-first, otherwise traverse it
breadth-first
public Vector<TreeNode> flattened(int depthP)
depthP - Only apply the function to nodes at or above this depth. A negative
depth means apply this to all nodes in the tree
public Vector<TreeNode> flattened()
public Vector<TreeNode> apply(Function func,
int depthP,
boolean depthFirst)
func - the Function to applydepthP - Only apply the function to nodes at or above this depth. A negative
depth means apply this to all nodes in the treedepthFirst - If true, traverse the tree depth-first, otherwise traverse it
breadth-first
public Vector<TreeNode> applyDepthFirst(Function func)
func - the function to apply
public Vector<TreeNode> applyDepthFirst(Function func,
int depthP)
func - the function to applydepthP - Only apply the function to nodes at or above this depth. A negative
depth means apply this to all nodes in the tree
public Vector<TreeNode> applyBreadthFirst(Function func)
func - the function to apply
public Vector<TreeNode> applyBreadthFirst(Function func,
int depthP)
func - the function to applydepthP - Only apply the function to nodes at or above this depth. A negative
depth means apply this to all nodes in the tree
public Vector<TreeNode> sorted(Order cmp,
int depthP)
cmp - an OrderingdepthP - Only return nodes at or above this depth. A negative
depth means return all nodes in the tree
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||