Class Node<T>
- java.lang.Object
-
- org.processmining.models.graphbased.directed.utils.Node<T>
-
public class Node<T> extends java.lang.Object
Represents a node of the Treeclass. The Node is also a container, and can be thought of as instrumentation to determine the location of the type T in the Tree .
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(Node<T> child)
Adds a child to the list of children for this Node. java.util.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 Nodeat the specified position in the child list. void
removeChildAt(int index)
Remove the Nodeelement at index index of the List >. void
setChildren(java.util.List<Node<T>> children)
Sets the children of a Nodeobject. void
setData(T data)
void
setParent(Node<T> parent)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Node
public Node()
Default ctor.
-
Node
public Node(T data)
Convenience ctor to create a Nodewith an instance of T. - Parameters:
data
- an instance of T.
-
-
Method Detail
-
getChildren
public java.util.List<Node<T>> getChildren()
Return the children of Node. The Tree is represented by a single root Node whose children are represented by a List >. Each of these Node elements in the List can have children. The getChildren() method will return the children of a Node . - Returns:
- the children of Node
-
setChildren
public void setChildren(java.util.List<Node<T>> children)
Sets the children of a Nodeobject. See docs for getChildren() for more information. - Parameters:
children
- the List> to set.
-
getNumberOfChildren
public int getNumberOfChildren()
Returns the number of immediate children of this Node. - Returns:
- the number of immediate children.
-
addChild
public void addChild(Node<T> child)
Adds a child to the list of children for this Node. The addition of the first child will create a new List >. - Parameters:
child
- a Nodeobject to set.
-
insertChildAt
public void insertChildAt(int index, Node<T> child) throws java.lang.IndexOutOfBoundsException
Inserts a Nodeat the specified position in the child list. Will * throw an ArrayIndexOutOfBoundsException if the index does not exist. - Parameters:
index
- the position to insert at.child
- the Nodeobject to insert. - Throws:
java.lang.IndexOutOfBoundsException
- if thrown.
-
removeChildAt
public void removeChildAt(int index) throws java.lang.IndexOutOfBoundsException
Remove the Nodeelement at index index of the List >. - Parameters:
index
- the index of the element to delete.- Throws:
java.lang.IndexOutOfBoundsException
- if thrown.
-
getData
public T getData()
-
setData
public void setData(T data)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-