public class Node<T> extends Object
Modifier and Type | Field and Description |
---|---|
List<Node<T>> |
children |
T |
data |
protected String |
name
Nodes have names
|
protected Tree<T> |
tree |
Constructor and Description |
---|
Node(Tree<T> tree,
String name,
T data)
Convenience ctor to create a Node
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(Node<T> child)
Adds a child to the list of children for this Node
|
List<Node<T>> |
getChildren()
Return the children of Node
|
T |
getData() |
Node<T> |
getParent() |
void |
setData(T data) |
void |
setParent(Node<T> parent) |
String |
toString() |
public List<Node<T>> getChildren()
public void addChild(Node<T> child)
child
- a Nodepublic T getData()
public void setData(T data)
Copyright © 2007-2019. All Rights Reserved.