Package org.chsrobotics.lib.util
Class NodeGraph<T>
java.lang.Object
org.chsrobotics.lib.util.NodeGraph<T>
- Type Parameters:
T
- Data type that can be held by the nodes.
Class representing a set of interconnected nodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Class forming a part of the node graph structure. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a bi-directional connection between two given nodes.createNode
(T data) Creates a new Node as part of this NodeGraph with the given data.Returns all Nodes in the NodeGraph.getConnectedNodes
(NodeGraph<T>.Node node) Returns all other nodes connected to the given node.
-
Constructor Details
-
NodeGraph
public NodeGraph()Constructs a new NodeGraph.
-
-
Method Details
-
createNode
Creates a new Node as part of this NodeGraph with the given data.- Parameters:
data
- The data to initialize the node with.- Returns:
- A new Node.
-
getConnectedNodes
Returns all other nodes connected to the given node.- Parameters:
node
- The node to check for connections.- Returns:
- All nodes connected to the given node.
-
getAllNodes
Returns all Nodes in the NodeGraph.- Returns:
- A Collection of all Nodes in the graph.
-
connectNodes
Creates a bi-directional connection between two given nodes.- Parameters:
nodeA
- The first node to connect.nodeB
- The second node to connect.
-