|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ITreeNode
Defines methods required by a tree node.
Method Summary | |
---|---|
void |
add(ITreeNode treeNode)
Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array. |
Iterator |
breadthFirstIterator()
Creates and returns an enumeration that traverses the subtree rooted at this node in breadth-first order. |
Iterator |
children()
Creates and returns a forward-order iterator of this node's children. |
Object |
clone()
Return a clone of this instance. |
Iterator |
depthFirstIterator()
Creates and returns an enumeration that traverses the subtree rooted at this node in depth-first order. |
ITreeNodeCollection |
getBreadthFirstList()
Creates and returns a list containing the subtree rooted at this node in breadth-first order. |
ITreeNode |
getChildAt(int index)
Returns the child at the specified index in this node's child array. |
int |
getChildCount()
Returns the number of children of this node. |
int |
getDepth()
Returns the depth of the tree rooted at this node -- the longest distance from this node to a leaf. |
ITreeNodeCollection |
getDepthFirstList()
Creates and returns a list containing the subtree rooted at this node in depth-first order. |
ITreeNode |
getFirstChild()
Returns this node's first child. |
ITreeNode |
getFirstLeaf()
Finds and returns the first leaf that is a descendant of this node -- either this node or its first child's first leaf. |
int |
getIndex(ITreeNode treeNode)
Returns the index of the specified child in this node's child array. |
ITreeNode |
getLastChild()
Returns this node's last child. |
ITreeNode |
getLastLeaf()
Finds and returns the last leaf that is a descendant of this node -- either this node or its last child's last leaf. |
int |
getLevel()
Returns the number of levels above this node -- the distance from the root to this node. |
ITreeNode |
getNextSibling()
Return the sibling after this. |
int |
getNodeCount()
Return the count of all nodes in the subtree rooted at this node. |
ITreeNode |
getParent()
Returns this node's parent or null if this node has no parent. |
ITreeNode[] |
getPath()
Returns the path from the root, to get to this node. |
ITreeNode |
getRoot()
Returns the root of the tree that contains this node. |
Object |
getUserObject()
Returns this node's user object. |
void |
insert(ITreeNode treeNode,
int index)
Removes treeNode from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex. |
boolean |
isChildAllowed()
Returns true if this node is allowed to have children. |
boolean |
isLeaf()
Returns true if this node has no children. |
boolean |
isRoot()
Returns true if this node is the root of the tree. |
void |
remove(int index)
Removes the child at the specified index from this node's children and sets that node's parent to null. |
void |
remove(ITreeNode treeNode)
Removes treeNode from this node's child array, giving it a null parent. |
void |
removeAllChildren()
Removes all of this node's children, setting their parents to null. |
void |
removeFromParent()
Removes the subtree rooted at this node from the tree, giving this node a null parent. |
void |
setChildAllowed(boolean isChildAllowed)
Determines whether or not this node is allowed to have children. |
void |
setParent(ITreeNode parent)
Sets this node's parent to parent but does not change the
parent's child array. |
void |
setUserObject(Object userObject)
Sets the user object for this node to userObject. |
String |
toString()
Return a string representation of this object. |
Methods inherited from interface org.vizzini.util.tree.IVisitable |
---|
acceptBreadthFirst, acceptDepthFirst |
Method Detail |
---|
void add(ITreeNode treeNode)
Iterator breadthFirstIterator()
Iterator children()
Object clone()
Iterator depthFirstIterator()
ITreeNodeCollection getBreadthFirstList()
ITreeNode getChildAt(int index)
int getChildCount()
int getDepth()
ITreeNodeCollection getDepthFirstList()
ITreeNode getFirstChild()
ITreeNode getFirstLeaf()
int getIndex(ITreeNode treeNode)
ITreeNode getLastChild()
ITreeNode getLastLeaf()
int getLevel()
ITreeNode getNextSibling()
int getNodeCount()
ITreeNode getParent()
ITreeNode[] getPath()
ITreeNode getRoot()
Object getUserObject()
void insert(ITreeNode treeNode, int index)
boolean isChildAllowed()
boolean isLeaf()
boolean isRoot()
void remove(int index)
void remove(ITreeNode treeNode)
void removeAllChildren()
void removeFromParent()
void setChildAllowed(boolean isChildAllowed)
void setParent(ITreeNode parent)
parent
but does not change the
parent's child array.
void setUserObject(Object userObject)
String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |