Class Node<T>
java.lang.Object
org.processmining.models.graphbased.directed.utils.Node<T>
Represents a node of the Tree class. The Node is also a container, and
can be thought of as instrumentation to determine the location of the type T
in the Tree.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child to the list of children for this Node. Return the children of Node. getData()
int
Returns the number of immediate children of this Node. 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<Node >. void
setChildren
(List<Node<T>> children) Sets the children of a Nodeobject. void
void
toString()
-
Constructor Details
-
Node
public Node()Default ctor. -
Node
Convenience ctor to create a Nodewith an instance of T. - Parameters:
data
- an instance of T.
-
-
Method Details
-
getChildren
Return the children of Node. The Tree is represented by a single root Node whose children are represented by a List<Node >. 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
Sets the children of a Nodeobject. See docs for getChildren() for more information. - Parameters:
children
- the List<Node> to set.
-
getNumberOfChildren
public int getNumberOfChildren()Returns the number of immediate children of this Node. - Returns:
- the number of immediate children.
-
addChild
Adds a child to the list of children for this Node. The addition of the first child will create a new List<Node >. - Parameters:
child
- a Nodeobject to set.
-
insertChildAt
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:
IndexOutOfBoundsException
- if thrown.
-
removeChildAt
Remove the Nodeelement at index index of the List<Node >. - Parameters:
index
- the index of the element to delete.- Throws:
IndexOutOfBoundsException
- if thrown.
-
getData
-
setData
-
toString
-
getParent
-
setParent
-