Package org.jtool.pdg

Class PDG


public class PDG extends Graph<PDGNode,Dependence>
An object storing information on a program dependence graph (PDG).
  • Constructor Details

    • PDG

      public PDG(CFG cfg)
      Creates a new, empty object for storing a PDG information. This method is not intended to be invoked by clients.
      Parameters:
      cfg - the corresponding CFG
  • Method Details

    • getCFG

      public CFG getCFG()
      Returns the CFG corresponding to this dependency graph.
      Returns:
      the CFG, or null if the corresponding CFG does not exist
    • setEntryNode

      public void setEntryNode(PDGEntry node)
      Sets the entry node for this PDG. This method is not intended to be invoked by clients.
      Parameters:
      node - the entry node to be set
    • getEntryNode

      public PDGEntry getEntryNode()
      Returns the entry node for this PDG.
      Returns:
      the entry node
    • setTimeoutOccurred

      public void setTimeoutOccurred(boolean bool)
      Sets whether the timeout occurred.
      Parameters:
      bool - true if the timeout occurred, otherwise false
    • timeoutOccurred

      public boolean timeoutOccurred()
      Tests if the timeout occurred.
      Returns:
      true if the timeout occurred, otherwise false
    • getId

      public long getId()
      Returns the identification number of this PDG.
      Returns:
      the identification number
    • getQualifiedName

      public QualifiedName getQualifiedName()
      Returns the fully-qualified name of this PDG.
      Returns:
      the fully-qualified name
    • getNodes

      public Set<PDGNode> getNodes()
      Returns all nodes of this PDG.
      Overrides:
      getNodes in class Graph<PDGNode,Dependence>
      Returns:
      the collection of the nodes
    • getEdges

      public List<Dependence> getEdges()
      Returns all edges of this PDG.
      Overrides:
      getEdges in class Graph<PDGNode,Dependence>
      Returns:
      the collection of the edges
    • getCDEdges

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

      public List<DD> getDDEdges()
      Returns all data dependence edges of this PDG.
      Returns:
      the collection of the edges
    • getNode

      public PDGNode getNode(long id)
      Finds the node having a given identification number.
      Parameters:
      id - the identification number to the node to be retrieved
      Returns:
      the found node, or null if the corresponding node is not found
    • getIncomingEdges

      public List<Dependence> 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<CD> getIncomingCDEdges(PDGNode node)
      Obtains control dependence edges incoming to a given node.
      Parameters:
      node - node the node
      Returns:
      the collection of the incoming control dependence edges
    • getIncomingDDEdges

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

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

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

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

      public boolean isDominated(PDGNode node)
      Tests if a given node is dominated by any control flow.
      Parameters:
      node - the node
      Returns:
      true if this is a dominated node, otherwise false
    • isTrueDominated

      public boolean isTrueDominated(PDGNode node)
      Tests if a given node is dominated by a true control flow.
      Parameters:
      node - the node
      Returns:
      true if this is a true-dominated node, otherwise false
    • isFalseDominated

      public boolean isFalseDominated(PDGNode node)
      Tests if a given node is dominated by a false control flow.
      Parameters:
      node - the node
      Returns:
      true if this is a false-dominated node, otherwise false
    • equals

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

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

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

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

      public String toString(String kindName)
      Obtains information on this dependency graph.
      Parameters:
      kindName - the kind name of this dependency graph
      Returns:
      the string representing the information on this dependency graph
    • toStringForNodes

      protected String toStringForNodes()
      Obtains information on all nodes enclosed in this dependency graph.
      Overrides:
      toStringForNodes in class Graph<PDGNode,Dependence>
      Returns:
      the string representing the information
    • toStringForEdges

      protected String toStringForEdges()
      Obtains information on all edges enclosed in this dependency graph.
      Overrides:
      toStringForEdges in class Graph<PDGNode,Dependence>
      Returns:
      the string representing the information
    • toStringForCDEdges

      protected String toStringForCDEdges()
      Obtains information on control dependence edges enclosed in this dependency graph.
      Returns:
      the string representing the information
    • toStringForDDEdges

      protected String toStringForDDEdges()
      Obtains information on data dependence edges enclosed in this dependency graph.
      Returns:
      the string representing the information