org.jtool.jxplatform.graph.pdg
Class PDG

java.lang.Object
  extended byorg.jtool.jxplatform.graph.Graph
      extended byorg.jtool.jxplatform.graph.pdg.PDG

public class PDG
extends Graph

An object storing information about a program dependence graph (PDG).

Author:
Katsuhsa Maruyama

Field Summary
protected  PDGMethodEntry entry
          An entry node of this PDG.
 
Fields inherited from class org.jtool.jxplatform.graph.Graph
edges, nodes
 
Constructor Summary
protected PDG()
          Creates a new, empty object.
  PDG(CFG cfg)
          Creates the PDG for a CFG.
 
Method Summary
protected  void add(Dependence edge)
          Adds a given PDG edge to this graph.
protected  void add(PDGNode node)
          Adds a given PDG node to this graph.
 PDGMethodEntry getEntryNode()
          Returns the entry node of this PDG.
 PDGNode getNode(CFGNode node)
          Return a PDG node which corresponds to a CFG node.
 PDGNode getNode(int id)
          Returns a PDG node with a given identifier.
 void print()
          Displays information about this PDG.
 void printCDG()
          Displays information about control dependence graph (CDG) extracted from this PDG.
 void printCDs(java.lang.StringBuffer buf)
          Collects information about control dependence edges of this graph for printing.
 void printDDG()
          Displays information about data dependence graph (DDG) extracted from this PDG.
 void printDDs(java.lang.StringBuffer buf)
          Collects information about data dependence edges of this graph for printing.
protected  void setEntryNode(PDGMethodEntry node)
          Sets the entry node of this PDG.
 java.lang.String write()
          Writes information about this CFG.
 void writeEdges(java.lang.StringBuffer buf)
          Collects information about edges of this CFG for writing an XML document.
 void writeNodes(java.lang.StringBuffer buf)
          Collects information about nodes of this CFG for writing an XML document.
 
Methods inherited from class org.jtool.jxplatform.graph.Graph
add, add, clear, contains, contains, equals, getEdges, getNodes, printEdges, printNodes, remove, remove, setEdges, setNodes, setSrcDstNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entry

protected PDGMethodEntry entry
An entry node of this PDG.

Constructor Detail

PDG

protected PDG()
Creates a new, empty object.


PDG

public PDG(CFG cfg)
    throws GraphException
Creates the PDG for a CFG.

Parameters:
cfg - A CFG of a method.
Throws:
GraphException - if the creation of the PDG fails.
Method Detail

setEntryNode

protected void setEntryNode(PDGMethodEntry node)
Sets the entry node of this PDG.

Parameters:
node - A entry node of this PDG.

getEntryNode

public PDGMethodEntry getEntryNode()
Returns the entry node of this PDG.

Returns:
The entry node of this PDG.

getNode

public PDGNode getNode(CFGNode node)
Return a PDG node which corresponds to a CFG node.

Parameters:
node - A CFG node.
Returns:
The corresponding node, or null if there is no corresponding node found.

getNode

public PDGNode getNode(int id)
Returns a PDG node with a given identifier.

Parameters:
id - The identifier of a node.
Returns:
The corresponding node, or null if there is no corresponding node found.

add

protected void add(PDGNode node)
Adds a given PDG node to this graph.

Parameters:
node - A node to be added.

add

protected void add(Dependence edge)
Adds a given PDG edge to this graph.

Parameters:
edge - An edge to be added.

print

public void print()
Displays information about this PDG.

Overrides:
print in class Graph

printCDG

public void printCDG()
Displays information about control dependence graph (CDG) extracted from this PDG.


printDDG

public void printDDG()
Displays information about data dependence graph (DDG) extracted from this PDG.


printCDs

public void printCDs(java.lang.StringBuffer buf)
Collects information about control dependence edges of this graph for printing.

Parameters:
buf - The information about the edges.

printDDs

public void printDDs(java.lang.StringBuffer buf)
Collects information about data dependence edges of this graph for printing.

Parameters:
buf - The information about the edges.

write

public java.lang.String write()
                       throws GraphException
Writes information about this CFG.

Throws:
GraphException - the write of this CFG fails.

writeNodes

public void writeNodes(java.lang.StringBuffer buf)
Collects information about nodes of this CFG for writing an XML document.

Overrides:
writeNodes in class Graph
Parameters:
buf - The information about the node.

writeEdges

public void writeEdges(java.lang.StringBuffer buf)
Collects information about edges of this CFG for writing an XML document.

Overrides:
writeEdges in class Graph
Parameters:
buf - The information about the node.