public static class TreeLayoutObserver.TreeNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<TreeLayoutObserver.TreeNode> |
children
The children of this node.
|
protected int |
depth
The depth of the node.
|
protected boolean |
firstChild
true if this node is the first child, otherwise
false . |
protected int |
height
The height of the node.
|
protected boolean |
lastChild
true if this node is the last child, otherwise
false . |
protected INodeLayout |
node
The wrapped
INodeLayout . |
protected int |
numOfDescendants
The number of descendants.
|
protected int |
numOfLeaves
The number of leaves.
|
protected int |
order
The order of this node.
|
protected TreeLayoutObserver |
owner
The
TreeLayoutObserver that controls this TreeLayoutObserver.TreeNode . |
protected TreeLayoutObserver.TreeNode |
parent
The parent of this node.
|
Modifier | Constructor and Description |
---|---|
protected |
TreeNode(INodeLayout node,
TreeLayoutObserver owner)
Creates a tree node related to given layout node
|
Modifier and Type | Method and Description |
---|---|
protected void |
addChild(TreeLayoutObserver.TreeNode child)
Adds given node to the list of this node's children and set its
parent to this node.
|
protected void |
findNewParent()
Finds a node that is the best parent for this node.
|
java.util.List<TreeLayoutObserver.TreeNode> |
getChildren() |
int |
getDepth() |
int |
getHeight() |
INodeLayout |
getNode() |
int |
getNumOfDescendants() |
int |
getNumOfLeaves() |
int |
getOrder()
Returns order in which nodes are visited during Deep First Search.
|
TreeLayoutObserver |
getOwner() |
TreeLayoutObserver.TreeNode |
getParent() |
boolean |
isAncestorOf(TreeLayoutObserver.TreeNode descendant) |
protected boolean |
isBetterParent(TreeLayoutObserver.TreeNode potentialParent)
Checks if a potential parent would be better for this node than its
current parent.
|
boolean |
isFirstChild() |
boolean |
isLastChild() |
protected void |
precomputeTree()
Performs a DFS on the tree structure and calculates all parameters of
its nodes.
|
protected final INodeLayout node
INodeLayout
.protected final TreeLayoutObserver owner
TreeLayoutObserver
that controls this TreeLayoutObserver.TreeNode
.protected int height
protected int depth
protected int numOfLeaves
protected int numOfDescendants
protected int order
protected final java.util.List<TreeLayoutObserver.TreeNode> children
protected TreeLayoutObserver.TreeNode parent
protected boolean firstChild
true
if this node is the first child, otherwise
false
.protected boolean lastChild
true
if this node is the last child, otherwise
false
.protected TreeNode(INodeLayout node, TreeLayoutObserver owner)
node
- the layout nodeowner
- TreeLayoutObserver
owning created nodepublic INodeLayout getNode()
Super Root
)public TreeLayoutObserver getOwner()
TreeLayoutObserver
owning this tree nodepublic int getHeight()
public int getDepth()
Super Root
public int getNumOfLeaves()
public int getNumOfDescendants()
public int getOrder()
TreeLayoutObserver.recomputeTree()
was
called after the nodes were added. In that case the order is
determined by order of nodes returned by
INodeLayout.getSuccessingNodes()
. Leaves are assigned
successive numbers starting from 0, other nodes have order equal to
the smallest order of their children.public java.util.List<TreeLayoutObserver.TreeNode> getChildren()
public TreeLayoutObserver.TreeNode getParent()
public boolean isFirstChild()
public boolean isLastChild()
protected void addChild(TreeLayoutObserver.TreeNode child)
child
- node to addprotected void precomputeTree()
Super Root
. Uses recurrence
to go through all the nodes.protected void findNewParent()
protected boolean isBetterParent(TreeLayoutObserver.TreeNode potentialParent)
Super Root
, which has depth
equal to -1 but is never a better parent than any other node).potentialParent
- potential parent to checkpublic boolean isAncestorOf(TreeLayoutObserver.TreeNode descendant)
descendant
- The TreeLayoutObserver.TreeNode
in question.Copyright (c) 2014 itemis AG and others. All rights reserved.