Class Node
- java.lang.Object
-
- com.intergral.deep.agent.tracepoint.handler.bfs.Node
-
public class Node extends Object
A node is a value to process in the BFS. It also links children to parents to ensure hierarchy in variables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNode.IConsumerThe consumer of the nodes when running a BFS.static interfaceNode.IParentThe parent of a processed node.static classNode.NodeValueThis type wraps an Object that we are to process.
-
Constructor Summary
Constructors Constructor Description Node(Node.NodeValue value, Node.IParent parent)Create a new node for the BFS.Node(Node.NodeValue value, Set<Node> children, Node.IParent parent)Create a new node for the BFS.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildren(Set<Node> children)Add child nodes.static voidbreadthFirstSearch(Node root, Node.IConsumer consumer)Start the breadth first search of the nodes.intdepth()Node.IParentgetParent()Node.NodeValuegetValue()
-
-
-
Constructor Detail
-
Node
public Node(Node.NodeValue value, Node.IParent parent)
Create a new node for the BFS.- Parameters:
value- the value to wrapparent- the parent of this node
-
Node
public Node(Node.NodeValue value, Set<Node> children, Node.IParent parent)
Create a new node for the BFS.- Parameters:
value- the value to wrapchildren- the children of this nodeparent- the parent of this node
-
-
Method Detail
-
breadthFirstSearch
public static void breadthFirstSearch(Node root, Node.IConsumer consumer)
Start the breadth first search of the nodes.- Parameters:
root- the root node to start fromconsumer- the consumer to use to collect more nodes.
-
addChildren
public void addChildren(Set<Node> children)
Add child nodes.- Parameters:
children- the children to add
-
getValue
public Node.NodeValue getValue()
-
getParent
public Node.IParent getParent()
-
depth
public int depth()
-
-