|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfc.util.Tree.Node
public static class Tree.Node
Constructor Summary | |
---|---|
Tree.Node(java.lang.Object data)
Creates a new Node. |
|
Tree.Node(Tree.Node parent,
java.lang.Object data)
Creates a new Node and adds it as a child of the specified Node |
Method Summary | |
---|---|
void |
add(Tree.Node child)
Adds the specified node as a new child node to this node. |
boolean |
containsChild(Tree.Node child)
Returns true if this node contains the specified element. |
boolean |
equals(java.lang.Object obj)
Calls super.equals(), i.e, reference equality. |
Tree.Node |
getChildContaining(java.lang.Object obj)
Returns the first child node whose data object equals the specified argument. |
java.util.List |
getChildren()
Returns the children of this node. |
java.lang.Object |
getData()
Returns the Object representing the data for this node, null if no data has been assigned. |
int |
getLevel()
Gets the level of this node starting from the root (the root node is at level 0) |
int |
getMaxDepth()
Returns the maximum depth of the tree starting from this node and following the deepest branch. |
Tree.Node |
getParent()
Returns the parent of the TreeNode, null if there is no parent |
java.util.Iterator |
getSiblings()
Returns the siblings of this node. |
boolean |
isLeaf()
Returns true is this node has no children, false otherwise |
boolean |
isNodeAncestor(Tree.Node ancestor)
Returns true if the specified node is an ancestor of this node false otherwise. |
boolean |
isNodeChild(Tree.Node child)
Returns true if the specified node is a child of this node false otherwise. |
boolean |
isNodeDescendant(Tree.Node descendent)
Returns true if the specified node is a descendent of this node false otherwise. |
boolean |
isNodeSibling(Tree.Node node)
Returns true if the specified node is a sibling of this node false otherwise. |
boolean |
isRoot()
Returns true if this node is the root node of the tree, false otherwise. |
java.util.Iterator |
iterator(Tree.IterationOrder order)
Returns an iterator for all the nodes in the tree, starting from this node onwards. |
int |
recursiveSize()
Returns the total number of all nodes reachable under this node. |
boolean |
remove(Tree.Node child)
Removes a single instance of the specified element from this node's children, if it is present. |
java.lang.String |
toString()
|
boolean |
valEquals(Tree.Node one,
Tree.Node other)
Compares the values of 2 nodes. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree.Node(java.lang.Object data)
#setParent(TreeNode)
method.
data
- the data object associated with this node.public Tree.Node(Tree.Node parent, java.lang.Object data)
parent
- the parent of this nodedata
- the data object associated with this nodeMethod Detail |
---|
public void add(Tree.Node child)
public boolean remove(Tree.Node child)
child
- child element to be removed from this node if present.
public java.util.List getChildren()
public Tree.Node getChildContaining(java.lang.Object obj)
obj
- the object against which the child nodes will be comparedpublic boolean containsChild(Tree.Node child)
Collection.contains(Object)
child
- node whose presence in this collection is to be tested.
public Tree.Node getParent()
public java.util.Iterator getSiblings()
Returns an iterator with no elements if there are no siblings or if this is the root node (which can have no siblings).
public java.lang.Object getData()
public int recursiveSize()
public boolean isRoot()
public boolean isNodeAncestor(Tree.Node ancestor)
public boolean isNodeChild(Tree.Node child)
public boolean isNodeDescendant(Tree.Node descendent)
public boolean isNodeSibling(Tree.Node node)
public boolean isLeaf()
public int getLevel()
public int getMaxDepth()
public java.util.Iterator iterator(Tree.IterationOrder order)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean valEquals(Tree.Node one, Tree.Node other)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |