Class GraphNode

Direct Known Subclasses:
CFGNode, PDGNode

public abstract class GraphNode extends GraphElement
A node object for a graph.
  • Field Details

    • id

      protected long id
      The identification number of this node.
    • incomingEdges

      protected List<GraphEdge> incomingEdges
      The collection of edges incoming to this node.
    • outgoingEdges

      protected List<GraphEdge> 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

      public void addIncomingEdge(GraphEdge edge)
      Adds an edge incoming to this node.
      Parameters:
      edge - the incoming edge to be added
    • addOutgoingEdge

      public void addOutgoingEdge(GraphEdge edge)
      Adds an edge outgoing from this node.
      Parameters:
      edge - the outgoing edge to be added
    • addIncomingEdges

      public void addIncomingEdges(List<GraphEdge> edges)
      Adds edges incoming to this node.
      Parameters:
      edges - the collection of the incoming edges to be added
    • addOutgoingEdges

      public void addOutgoingEdges(List<GraphEdge> edges)
      Adds edges outgoing to this node.
      Parameters:
      edges - the collection of the outgoing edges to be added
    • removeIncomingEdge

      public void removeIncomingEdge(GraphEdge edge)
      Removes an edge incoming to this node.
      Parameters:
      edge - the incoming edge to be removed
    • removeOutgoingEdge

      public void removeOutgoingEdge(GraphEdge edge)
      Removes an edge outgoing from this node.
      Parameters:
      edge - the outgoing edge to be removed
    • getIncomingEdges

      public List<GraphEdge> getIncomingEdges()
      Returns edges incoming to this node.
      Returns:
      the collection of the incoming edges
    • getOutgoingEdges

      public List<GraphEdge> getOutgoingEdges()
      Returns edges outgoing from this node.
      Returns:
      the collection of the outgoing edges
    • getSrcNodes

      public Set<GraphNode> getSrcNodes()
      Returns source nodes for this node.
      Returns:
      the collection of the source nodes
    • getDstNodes

      public Set<GraphNode> getDstNodes()
      Returns destination nodes for this node.
      Returns:
      The collection of destination nodes
    • equals

      public boolean equals(GraphElement elem)
      Tests if a given graph element is equal to this graph element.
      Specified by:
      equals in class GraphElement
      Parameters:
      elem - the graph element to be checked
      Returns:
      the true if the given graph element is equal to this graph element
    • equals

      public boolean equals(GraphNode node)
      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()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Obtains information on this node.
      Overrides:
      toString in class Object
      Returns:
      the string representing the information
    • sortGraphNode

      public static List<GraphNode> sortGraphNode(Collection<? extends GraphNode> collection)
      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