|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectunbbayes.util.datastructure.Node<T>
public class Node<T>
| Field Summary | |
|---|---|
List<Node<T>> |
children
|
T |
data
|
Node<T> |
parent
|
| Constructor Summary | |
|---|---|
Node()
Default ctor. |
|
Node(T data)
Convenience ctor to create a Node |
|
| Method Summary | |
|---|---|
void |
addChild(Node<T> child)
Adds a child to the list of children for this Node |
Node<T> |
getChild(int index)
|
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 |
void |
removeAll()
|
void |
removeChildAt(int index)
Remove the Node |
void |
setChildren(List<Node<T>> children)
Sets the children of a Node |
void |
setData(T data)
|
void |
setParent(Node<T> p)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public T data
public List<Node<T>> children
public Node<T> parent
| Constructor Detail |
|---|
public Node()
public Node(T data)
data - an instance of T.| Method Detail |
|---|
public void setParent(Node<T> p)
public Node<T> getParent()
public List<Node<T>> getChildren()
public void setChildren(List<Node<T>> children)
children - the Listpublic int getNumberOfChildren()
public Node<T> getChild(int index)
public void addChild(Node<T> child)
child - a Node
public 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 void removeAll()
public T getData()
public void setData(T data)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||