T - the generic typepublic class TreeNode<T> extends Object implements ITreeNode<T>
| Constructor and Description |
|---|
TreeNode()
Instantiates a new tree node.
|
TreeNode(T value)
Instantiates a new tree node.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(ITreeNode<T> child)
Adds the child.
|
void |
addChildAt(int index,
ITreeNode<T> child)
Adds the child.
|
boolean |
equals(ITreeNode<T> treeNode)
Equals.
|
List<ITreeNode<T>> |
getAllSiblings()
Returns all siblings of this node in the parent's children list.
|
int |
getChildCount()
Gets the child count.
|
List<ITreeNode<T>> |
getChildren()
Gets the children.
|
int |
getDepth()
Returns the depth of the tree beginning at this node Returns 0 if this node has no children.
|
String |
getDisplayValue()
Gets the optional display value.
|
int |
getLevel()
Returns the distance from the root to this node.
|
ITreeNode<T> |
getNextSibling()
Returns the next sibling of this node in the parent's children list.
|
ITreeNode<T> |
getParent()
Gets the parent.
|
ITreeNode<T> |
getPreviousSibling()
Returns the previous sibling of this node in the parent's children list.
|
T |
getValue()
Gets the value.
|
boolean |
hasChildren()
Checks for children.
|
int |
hashCode() |
boolean |
hasParent()
Checks for parent.
|
boolean |
isLeaf()
Checks if is leaf.
|
boolean |
isNode()
Checks if is node.
|
boolean |
isRoot()
Checks if this treenode is root.
|
void |
removeChild(ITreeNode<T> child)
Removes the child.
|
void |
removeChildAt(int index)
Removes the child.
|
void |
setChildren(List<ITreeNode<T>> children)
Sets the children.
|
void |
setDisplayValue(String displayValue)
Sets the optional display value.
|
void |
setParent(ITreeNode<T> parent)
Sets the parent.
|
void |
setValue(T value)
Sets the value.
|
List<ITreeNode<T>> |
toList()
To list.
|
void |
traverse(ITreeNode<T> node,
List<ITreeNode<T>> list)
Traverse.
|
public TreeNode()
public TreeNode(T value)
value - the valuepublic void addChildAt(int index,
ITreeNode<T> child)
throws IndexOutOfBoundsException
addChildAt in interface ITreeNode<T>index - the indexchild - the childIndexOutOfBoundsException - the index out of bounds exceptionpublic List<ITreeNode<T>> getAllSiblings()
getAllSiblings in interface ITreeNode<T>public int getChildCount()
getChildCount in interface ITreeNode<T>public List<ITreeNode<T>> getChildren()
getChildren in interface ITreeNode<T>public int getDepth()
public String getDisplayValue()
getDisplayValue in interface ITreeNode<T>public int getLevel()
public ITreeNode<T> getNextSibling()
getNextSibling in interface ITreeNode<T>public ITreeNode<T> getPreviousSibling()
getPreviousSibling in interface ITreeNode<T>public T getValue()
public boolean hasChildren()
hasChildren in interface ITreeNode<T>public boolean hasParent()
public boolean isLeaf()
public boolean isNode()
public boolean isRoot()
public void removeChild(ITreeNode<T> child)
removeChild in interface ITreeNode<T>child - the childpublic void removeChildAt(int index)
throws IndexOutOfBoundsException
removeChildAt in interface ITreeNode<T>index - the indexIndexOutOfBoundsException - the index out of bounds exceptionpublic void setChildren(List<ITreeNode<T>> children)
setChildren in interface ITreeNode<T>children - the new childrenpublic void setDisplayValue(String displayValue)
setDisplayValue in interface ITreeNode<T>displayValue - the new optional display valuepublic void setValue(T value)
Copyright © 2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.