TreeNode
- Type of elements used as nodes in the treepublic interface TreeForTreeLayout<TreeNode>
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.
Modifier and Type | Method and Description |
---|---|
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.
|
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)]Copyright © 2023. All rights reserved.