|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OrderedTreeNode
A TreeNode
that is aware of its relationships not only to its parents
and children, but also to its siblings.
The order and placement of children is significant.
Method Summary | |
---|---|
OrderedTreeNode |
getFirstChild()
Returns the first child of this node. |
OrderedTreeNode |
getFirstLeaf()
Finds and returns the first leaf that is a descendant of this node -- either this node or its first child's first leaf. |
OrderedTreeNode |
getLastChild()
Returns the last child of this node. |
OrderedTreeNode |
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. |
OrderedTreeNode |
getNextLeaf()
Returns the leaf after this node or null if this node is the last leaf in the tree. |
OrderedTreeNode |
getNextSibling()
Returns the next sibling node. |
OrderedTreeNode |
getOrderedParent()
Returns the parent of this node, cast as an OrderedTreeNode. |
OrderedTreeNode |
getPreviousLeaf()
Returns the leaf before this node or null if this node is the first leaf in the tree. |
OrderedTreeNode |
getPreviousSibling()
Returns the previous sibling node. |
boolean |
hasChildren()
Reports whether this node has any children. |
boolean |
isNodeAncestor(OrderedTreeNode anotherNode)
Returns true if anotherNode is an ancestor of this node
-- if it is this node, this node's parent, or an ancestor of this
node's parent. |
OrderedTreeNode |
nextPostOrderNode()
Returns the next node in the tree relative to the current node, in post-order traversal order. |
OrderedTreeNode |
nextPreOrderNode()
Returns the next node in the tree relative to the current node, in pre-order traversal order. |
int |
siblingIndex()
Returns this node's position within the siblings. |
Methods inherited from interface javax.swing.tree.TreeNode |
---|
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
Method Detail |
---|
OrderedTreeNode getOrderedParent()
int siblingIndex()
OrderedTreeNode getPreviousSibling()
OrderedTreeNode getNextSibling()
boolean hasChildren()
OrderedTreeNode getFirstChild()
OrderedTreeNode getLastChild()
OrderedTreeNode nextPreOrderNode()
OrderedTreeNode nextPostOrderNode()
OrderedTreeNode getFirstLeaf()
DefaultMutableTreeNode
).
TreeNode.isLeaf()
,
DefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)
OrderedTreeNode getLastLeaf()
DefaultMutableTreeNode
).
TreeNode.isLeaf()
,
DefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)
OrderedTreeNode getNextLeaf()
In this implementation of the MutableNode
interface,
this operation is very inefficient. In order to determine the
next node, this method first performs a linear search in the
parent's child-list in order to find the current node.
That implementation makes the operation suitable for short
traversals from a known position. But to traverse all of the
leaves in the tree, you should use depthFirstEnumeration
to enumerate the nodes in the tree and use isLeaf
on each node to determine which are leaves.
(Liberated from DefaultMutableTreeNode
).
DefaultMutableTreeNode.depthFirstEnumeration()
,
TreeNode.isLeaf()
OrderedTreeNode getPreviousLeaf()
In this implementation of the MutableNode
interface,
this operation is very inefficient. In order to determine the
previous node, this method first performs a linear search in the
parent's child-list in order to find the current node.
That implementation makes the operation suitable for short
traversals from a known position. But to traverse all of the
leaves in the tree, you should use depthFirstEnumeration
to enumerate the nodes in the tree and use isLeaf
on each node to determine which are leaves.
(Liberated from DefaultMutableTreeNode
).
DefaultMutableTreeNode.depthFirstEnumeration()
,
TreeNode.isLeaf()
int getLevel()
DefaultMutableTreeNode
).
boolean isNodeAncestor(OrderedTreeNode anotherNode)
anotherNode
is an ancestor of this node
-- if it is this node, this node's parent, or an ancestor of this
node's parent. (Note that a node is considered an ancestor of itself.)
If anotherNode
is null, this method returns false. This
operation is at worst O(h) where h is the distance from the root to
this node.
anotherNode
- node to test as an ancestor of this node
anotherNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |