Package org.jtool.pdg

Class DependencyGraph

java.lang.Object
org.jtool.pdg.DependencyGraph
Direct Known Subclasses:
SDG

public class DependencyGraph extends Object
An object storing information on a dependency graph consisting of ClDGs.
  • Constructor Details

    • DependencyGraph

      public DependencyGraph(String name)
      Creates a dependency graph. This method is not intended to be invoked by clients.
      Parameters:
      name - the name to be set
  • Method Details

    • getName

      public String getName()
      Returns the name of this dependency graph.
      Returns:
      the name
    • add

      public void add(ClDG cldg)
      Adds a ClDG to this dependency graph.
      Parameters:
      cldg - the ClDG to be added
    • add

      public void add(PDG pdg)
      Adds a PDG to to this dependency graph.
      Parameters:
      pdg - the PDG to be added
    • getClDGs

      public Set<ClDG> getClDGs()
      Returns ClDGs contained in this dependency graph.
      Returns:
      the collection of all the contained ClDGs
    • getPDGs

      public Set<PDG> getPDGs()
      Returns PDGs contained in this dependency graph.
      Returns:
      the collection of all the contained PDGs
    • getClDG

      public ClDG getClDG(String fqn)
      Finds a ClDG having a given name from ClDGs contained in this dependency graph.
      Parameters:
      fqn - the fully-qualified name of the ClDG to be retrieved
      Returns:
      the found ClDG, or null if the corresponding ClDG is not found
    • getPDG

      public PDG getPDG(String fqn)
      Finds a PDG having a given name from PDGs contained in this dependency graph.
      Parameters:
      fqn - the fully-qualified name of the PDG to be retrieved
      Returns:
      the found PDG, or null if the corresponding PDG is not found
    • getClDG

      public ClDG getClDG(JavaClass jclass)
      Finds a ClDG corresponding to a given class from ClDGs contained in this dependency graph.
      Parameters:
      jclass - the class for the ClDG to be retrieved
      Returns:
      the found ClDG, or null if the corresponding ClDG is not found
    • getPDG

      public PDG getPDG(JavaMethod jmethod)
      Finds a PDG corresponding to a given method from PDGs contained in this dependency graph.
      Parameters:
      jmethod - the method for the PDG to be retrieved
      Returns:
      the found PDG, or null if the corresponding PDG is not found
    • getPDG

      public PDG getPDG(JavaField jfield)
      Finds a PDG corresponding to a given field from PDGs contained in this dependency graph.
      Parameters:
      jfield - the field for the PDG to be retrieved
      Returns:
      the found PDG, or null if the corresponding PDG is not found
    • add

      public void add(PDGNode node)
      Adds a node to this dependency graph. This method is not intended to be invoked by clients.
      Parameters:
      node - the node to be added
    • add

      public void add(DependencyGraphEdge edge)
      Adds an edge to this dependency graph. This method is not intended to be invoked by clients.
      Parameters:
      edge - the dependence edge to be added
    • getNodes

      public Set<PDGNode> getNodes()
      Returns all nodes of this dependency graph.
      Returns:
      the collection of the nodes
    • getEdges

      public List<DependencyGraphEdge> getEdges()
      Returns all edges of this dependency graph.
      Returns:
      the collection of the edges
    • getCDEdges

      public List<DependencyGraphEdge> getCDEdges()
      Returns all control dependence edges of this dependency graph.
      Returns:
      the collection of the edges
    • getDDEdges

      public List<DependencyGraphEdge> getDDEdges()
      Returns all data dependence edges of this dependency graph.
      Returns:
      the collection of the edges
    • getInterPDGEdges

      public List<DependencyGraphEdge> getInterPDGEdges()
      Obtains edges that connect nodes in different PDGs.
      Returns:
      the collection of the edges
    • getIncomingEdges

      public List<DependencyGraphEdge> getIncomingEdges(PDGNode node)
      Obtains dependence edges incoming to a given node.
      Parameters:
      node - the node
      Returns:
      the collection of the incoming edges
    • getIncomingCDEdges

      public List<DependencyGraphEdge> getIncomingCDEdges(PDGNode node)
      Obtains control dependence edges incoming to a given node.
      Parameters:
      node - the node
      Returns:
      the collection of the incoming edges
    • getIncomingDDEdges

      public List<DependencyGraphEdge> getIncomingDDEdges(PDGNode node)
      Obtains data dependence edges incoming to this node.
      Parameters:
      node - the node
      Returns:
      the collection of the incoming edges
    • getOutgoingEdges

      public List<DependencyGraphEdge> getOutgoingEdges(PDGNode node)
      Obtains dependence edges outgoing from a given node.
      Parameters:
      node - the node
      Returns:
      the collection of the outgoing edges
    • getOutgoingCDEdges

      public List<DependencyGraphEdge> getOutgoingCDEdges(PDGNode node)
      Obtains control dependence edges outgoing from a given node.
      Parameters:
      node - the node
      Returns:
      the collection of the outgoing edges
    • getOutgoingDDEdges

      public List<DependencyGraphEdge> getOutgoingDDEdges(PDGNode node)
      Obtains data dependence edges outgoing from a given node.
      Parameters:
      node - the node
      Returns:
      the collection of the outgoing edges
    • addUncoveredFieldAccessEdge

      public void addUncoveredFieldAccessEdge(InterPDGDD edge)
      Adds an edge that uncovers an field access. This method is not intended to be invoked by clients.
      Parameters:
      edge - the edge to be added
    • existsUncoveredFieldAccessEdge

      public boolean existsUncoveredFieldAccessEdge(PDGNode src, PDGNode dst)
      Tests there is a dependence edge that uncovers field accesses, connecting two nodes.
      Parameters:
      src - the source node
      dst - the destination node
      Returns:
      true if a dependence edge was found, otherwise false
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(DependencyGraph graph)
      Tests if a given dependency graph is equal to this dependency graph.
      Parameters:
      graph - the dependency graph to be checked
      Returns:
      true if the given dependency graph is equal to this dependency graph
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • print

      public void print()
      Displays information on this graph.
    • toString

      public String toString()
      Obtains information on this dependency graph.
      Overrides:
      toString in class Object
      Returns:
      the string representing the information on this dependency graph