T
- the actual implementation type of this MutableTreeNodeImplpublic class MutableTreeNodeImpl<T extends MutableTreeNode<T>> extends java.lang.Object implements MutableTreeNode<T>
MutableTreeNode
.Modifier and Type | Field and Description |
---|---|
private java.util.List<T> |
children |
private java.util.List<T> |
childrenView |
private T |
parent |
Constructor and Description |
---|
MutableTreeNodeImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(int index,
T child)
Adds the given child to this nodes children list and setting the childs parent field to this node.
|
java.util.List<T> |
getChildren()
Returns the sub nodes of this node.
|
T |
getParent()
Returns the parent node or null if this node is the root.
|
T |
removeChild(int index)
Removes the child with the given index.
|
void |
setChild(int index,
T child)
Sets the child node at the given index to the given node.
|
private static <T extends MutableTreeNode<T>> |
setParent(T node,
MutableTreeNodeImpl<T> parent) |
private final java.util.List<T extends MutableTreeNode<T>> children
private final java.util.List<T extends MutableTreeNode<T>> childrenView
private T extends MutableTreeNode<T> parent
public T getParent()
TreeNode
getParent
in interface TreeNode<T extends MutableTreeNode<T>>
public java.util.List<T> getChildren()
GraphNode
getChildren
in interface GraphNode<T extends MutableTreeNode<T>>
public void addChild(int index, T child)
MutableTreeNode
addChild
in interface MutableTreeNode<T extends MutableTreeNode<T>>
index
- the index under which to insert this child into the children listchild
- the child node to addpublic void setChild(int index, T child)
MutableTreeNode
setChild
in interface MutableTreeNode<T extends MutableTreeNode<T>>
index
- the index under which to set this child into the children listchild
- the child node to setpublic T removeChild(int index)
MutableTreeNode
removeChild
in interface MutableTreeNode<T extends MutableTreeNode<T>>
index
- the index of the child to remove.private static <T extends MutableTreeNode<T>> void setParent(T node, MutableTreeNodeImpl<T> parent)