|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
TreeNode
- public interface TreeForTreeLayout<TreeNode>
Represents a tree to be used by the TreeLayout
.
The TreeForTreeLayout interface is designed to best match the implemented
layout algorithm and to ensure the algorithm's time complexity promises in
all possible cases. However in most situation a client must not deal with all
details of this interface and can directly use the
AbstractTreeForTreeLayout
to implement this
interface or even use the
DefaultTreeForTreeLayout
class directly.
Also see this overview.
Method Summary | |
---|---|
Iterable<TreeNode> |
getChildren(TreeNode parentNode)
Returns the children of a parent node. |
Iterable<TreeNode> |
getChildrenReverse(TreeNode parentNode)
Returns the children of a parent node, in reverse order. |
TreeNode |
getFirstChild(TreeNode parentNode)
Returns the first child of a parent node. |
TreeNode |
getLastChild(TreeNode parentNode)
Returns the last child of a parent node. |
TreeNode |
getRoot()
Returns the the root of the tree. |
boolean |
isChildOfParent(TreeNode node,
TreeNode parentNode)
Tells if a node is a child of a given parentNode. |
boolean |
isLeaf(TreeNode node)
Tells if a node is a leaf in the tree. |
Method Detail |
---|
TreeNode getRoot()
Time Complexity: O(1)
boolean isLeaf(TreeNode node)
Time Complexity: O(1)
node
-
boolean isChildOfParent(TreeNode node, TreeNode parentNode)
Time Complexity: O(1)
node
- parentNode
-
Iterable<TreeNode> getChildren(TreeNode parentNode)
Time Complexity: O(1)
parentNode
- [!isLeaf(parentNode)]
Iterable<TreeNode> getChildrenReverse(TreeNode parentNode)
Time Complexity: O(1)
parentNode
- [!isLeaf(parentNode)]
TreeNode getFirstChild(TreeNode parentNode)
Time Complexity: O(1)
parentNode
- [!isLeaf(parentNode)]
TreeNode getLastChild(TreeNode parentNode)
Time Complexity: O(1)
parentNode
- [!isLeaf(parentNode)]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |