Package org.jtool.graph
Class GraphNode
java.lang.Object
org.jtool.graph.GraphElement
org.jtool.graph.GraphNode
A node object for a graph.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
The identification number of this node.The collection of edges incoming to this node.The collection of edges outgoing from this node. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GraphNode
(long id) Creates a new, empty object that represents a node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIncomingEdge
(GraphEdge edge) Adds an edge incoming to this node.void
addIncomingEdges
(List<GraphEdge> edges) Adds edges incoming to this node.void
addOutgoingEdge
(GraphEdge edge) Adds an edge outgoing from this node.void
addOutgoingEdges
(List<GraphEdge> edges) Adds edges outgoing to this node.void
clear()
Clears information on this node.boolean
equals
(GraphElement elem) Tests if a given graph element is equal to this graph element.boolean
Tests if a given node is equal to this node.Returns destination nodes for this node.long
getId()
Returns the identification number of this node.Returns edges incoming to this node.Returns edges outgoing from this node.Returns source nodes for this node.int
hashCode()
void
removeIncomingEdge
(GraphEdge edge) Removes an edge incoming to this node.void
removeOutgoingEdge
(GraphEdge edge) Removes an edge outgoing from this node.void
setId
(long id) Sets the identification number.sortGraphNode
(Collection<? extends GraphNode> collection) Sorts the collection of nodes in the order of identification numberstoString()
Obtains information on this node.Methods inherited from class org.jtool.graph.GraphElement
difference, equals, equals, getIdString, intersection, subset, subsetEqual, union
-
Field Details
-
id
protected long idThe identification number of this node. -
incomingEdges
The collection of edges incoming to this node. -
outgoingEdges
The collection of edges outgoing from this node.
-
-
Constructor Details
-
GraphNode
protected GraphNode(long id) Creates a new, empty object that represents a node.- Parameters:
id
- the identification number this node independently has
-
-
Method Details
-
clear
public void clear()Clears information on this node. -
setId
public void setId(long id) Sets the identification number.- Parameters:
id
- the identification number to be assigned
-
getId
public long getId()Returns the identification number of this node.- Returns:
- the identification number
-
addIncomingEdge
Adds an edge incoming to this node.- Parameters:
edge
- the incoming edge to be added
-
addOutgoingEdge
Adds an edge outgoing from this node.- Parameters:
edge
- the outgoing edge to be added
-
addIncomingEdges
Adds edges incoming to this node.- Parameters:
edges
- the collection of the incoming edges to be added
-
addOutgoingEdges
Adds edges outgoing to this node.- Parameters:
edges
- the collection of the outgoing edges to be added
-
removeIncomingEdge
Removes an edge incoming to this node.- Parameters:
edge
- the incoming edge to be removed
-
removeOutgoingEdge
Removes an edge outgoing from this node.- Parameters:
edge
- the outgoing edge to be removed
-
getIncomingEdges
Returns edges incoming to this node.- Returns:
- the collection of the incoming edges
-
getOutgoingEdges
Returns edges outgoing from this node.- Returns:
- the collection of the outgoing edges
-
getSrcNodes
Returns source nodes for this node.- Returns:
- the collection of the source nodes
-
getDstNodes
Returns destination nodes for this node.- Returns:
- The collection of destination nodes
-
equals
Tests if a given graph element is equal to this graph element.- Specified by:
equals
in classGraphElement
- Parameters:
elem
- the graph element to be checked- Returns:
- the
true
if the given graph element is equal to this graph element
-
equals
Tests if a given node is equal to this node.- Parameters:
node
- the node to be checked- Returns:
- the
true
if the given node is equal to this node
-
hashCode
public int hashCode() -
toString
Obtains information on this node. -
sortGraphNode
Sorts the collection of nodes in the order of identification numbers- Parameters:
collection
- the collection of nodes to be sorted- Returns:
- the sorted list of the nodes
-