Top Description Methods
org.abego.treelayout

public Interface TreeForTreeLayout<TreeNode>

Known Direct Implementers
org.abego.treelayout.util.AbstractTreeForTreeLayout
Type Parameters
<TreeNode>
Type of elements used as nodes in the tree

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 org.abego.treelayout.util.AbstractTreeForTreeLayout to implement this interface or even use the org.abego.treelayout.util.DefaultTreeForTreeLayout class directly.

Also see this overview.
Author
Udo Borkowski ([email protected])

Method Summary

Modifier and TypeMethod and Description
public Iterable<TreeNode>

Returns:

the children of the given parentNode, from first to last
getChildren
(TreeNode
[!isLeaf(parentNode)]
parentNode
)

Returns the children of a parent node.

public Iterable<TreeNode>

Returns:

the children of given parentNode, from last to first
getChildrenReverse
(TreeNode
[!isLeaf(parentNode)]
parentNode
)

Returns the children of a parent node, in reverse order.

public TreeNode

Returns:

the first child of the parentNode
getFirstChild
(TreeNode
[!isLeaf(parentNode)]
parentNode
)

Returns the first child of a parent node.

public TreeNode

Returns:

the last child of the parentNode
getLastChild
(TreeNode
[!isLeaf(parentNode)]
parentNode
)

Returns the last child of a parent node.

public TreeNode

Returns:

the root of the tree
getRoot
()

Returns the the root of the tree.

public boolean

Returns:

true iff the node is a child of the given parentNode
isChildOfParent
(TreeNode
 
node
,
TreeNode
 
parentNode
)

Tells if a node is a child of a given parentNode.

public boolean

Returns:

true iff node is a leaf in the tree, i.e. has no children.
isLeaf
(TreeNode
 
node
)

Tells if a node is a leaf in the tree.

Method Detail

getChildrenback to summary
public Iterable<TreeNode> getChildren(TreeNode parentNode)

Returns the children of a parent node.

Time Complexity: O(1)

Parameters
parentNode:TreeNode

[!isLeaf(parentNode)]

Returns:Iterable<TreeNode>

the children of the given parentNode, from first to last

getChildrenReverseback to summary
public Iterable<TreeNode> getChildrenReverse(TreeNode parentNode)

Returns the children of a parent node, in reverse order.

Time Complexity: O(1)

Parameters
parentNode:TreeNode

[!isLeaf(parentNode)]

Returns:Iterable<TreeNode>

the children of given parentNode, from last to first

getFirstChildback to summary
public TreeNode getFirstChild(TreeNode parentNode)

Returns the first child of a parent node.

Time Complexity: O(1)

Parameters
parentNode:TreeNode

[!isLeaf(parentNode)]

Returns:TreeNode

the first child of the parentNode

getLastChildback to summary
public TreeNode getLastChild(TreeNode parentNode)

Returns the last child of a parent node.

Time Complexity: O(1)

Parameters
parentNode:TreeNode

[!isLeaf(parentNode)]

Returns:TreeNode

the last child of the parentNode

getRootback to summary
public TreeNode getRoot()

Returns the the root of the tree.

Time Complexity: O(1)

Returns:TreeNode

the root of the tree

isChildOfParentback to summary
public boolean isChildOfParent(TreeNode node, TreeNode parentNode)

Tells if a node is a child of a given parentNode.

Time Complexity: O(1)

Parameters
node:TreeNode

 

parentNode:TreeNode

 

Returns:boolean

true iff the node is a child of the given parentNode

isLeafback to summary
public boolean isLeaf(TreeNode node)

Tells if a node is a leaf in the tree.

Time Complexity: O(1)

Parameters
node:TreeNode

 

Returns:boolean

true iff node is a leaf in the tree, i.e. has no children.