public class Node<T> extends Object
| Modifier and Type | Method and Description |
|---|---|
Node<T> |
addChild(Node<T> child)
Adds a child to the list of children for this Node
|
Node<T> |
addChild(T data) |
List<Node<T>> |
collectParents(NodePredicate<T> predicate) |
Node<T> |
findParent(NodePredicate<T> predicate)
Finds the parent which satisfies the predicate.
|
List<Node<T>> |
getChildren()
Return the children of Node
|
T |
getData() |
int |
getNumberOfChildren()
Returns the number of immediate children of this Node
|
Node<T> |
getParent() |
void |
insertChildAt(int index,
Node<T> child)
Inserts a Node
|
boolean |
removeChild(Node<T> child) |
void |
removeChildAt(int index)
Remove the Node
|
void |
setData(T data) |
String |
toString() |
public Node(T data)
public Node<T> findParent(NodePredicate<T> predicate)
predicate - public List<Node<T>> collectParents(NodePredicate<T> predicate)
public List<Node<T>> getChildren()
public int getNumberOfChildren()
public Node<T> addChild(Node<T> child)
child - a Nodepublic void insertChildAt(int index,
Node<T> child)
throws IndexOutOfBoundsException
index - the position to insert at.child - the NodeIndexOutOfBoundsException - if thrown.public void removeChildAt(int index)
throws IndexOutOfBoundsException
index - the index of the element to delete.IndexOutOfBoundsException - if thrown.public T getData()
public void setData(T data)
Copyright © 2014 JBoss, a division of Red Hat. All rights reserved.