|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abego.treelayout.util.AbstractTreeForTreeLayout<TreeNode>
TreeNode
- public abstract class AbstractTreeForTreeLayout<TreeNode>
Provides an easy way to implement the TreeForTreeLayout
interface by
defining just two simple methods and a constructor.
To use this class the underlying tree must provide the children as a list
(see getChildrenList(Object)
and give direct access to the parent of
a node (see getParent(Object)
).
See also DefaultTreeForTreeLayout
.
Constructor Summary | |
---|---|
AbstractTreeForTreeLayout(TreeNode root)
|
Method Summary | |
---|---|
Iterable<TreeNode> |
getChildren(TreeNode node)
Returns the children of a parent node. |
abstract List<TreeNode> |
getChildrenList(TreeNode node)
Return the children of a node as a List . |
Iterable<TreeNode> |
getChildrenReverse(TreeNode node)
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. |
abstract TreeNode |
getParent(TreeNode node)
Returns the parent of a node, if it has one. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTreeForTreeLayout(TreeNode root)
Method Detail |
---|
public abstract TreeNode getParent(TreeNode node)
Time Complexity: O(1)
node
-
public abstract List<TreeNode> getChildrenList(TreeNode node)
List
.
Time Complexity: O(1)
Also the access to an item of the list must have time complexity O(1).
A client must not modify the returned list.
node
-
public TreeNode getRoot()
TreeForTreeLayout
Time Complexity: O(1)
getRoot
in interface TreeForTreeLayout<TreeNode>
public boolean isLeaf(TreeNode node)
TreeForTreeLayout
Time Complexity: O(1)
isLeaf
in interface TreeForTreeLayout<TreeNode>
public boolean isChildOfParent(TreeNode node, TreeNode parentNode)
TreeForTreeLayout
Time Complexity: O(1)
isChildOfParent
in interface TreeForTreeLayout<TreeNode>
public Iterable<TreeNode> getChildren(TreeNode node)
TreeForTreeLayout
Time Complexity: O(1)
getChildren
in interface TreeForTreeLayout<TreeNode>
node
- [!isLeaf(parentNode)]
public Iterable<TreeNode> getChildrenReverse(TreeNode node)
TreeForTreeLayout
Time Complexity: O(1)
getChildrenReverse
in interface TreeForTreeLayout<TreeNode>
node
- [!isLeaf(parentNode)]
public TreeNode getFirstChild(TreeNode parentNode)
TreeForTreeLayout
Time Complexity: O(1)
getFirstChild
in interface TreeForTreeLayout<TreeNode>
parentNode
- [!isLeaf(parentNode)]
public TreeNode getLastChild(TreeNode parentNode)
TreeForTreeLayout
Time Complexity: O(1)
getLastChild
in interface TreeForTreeLayout<TreeNode>
parentNode
- [!isLeaf(parentNode)]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |