soot.toolkits.graph
Class UnitGraph

java.lang.Object
  |
  +--soot.toolkits.graph.UnitGraph
All Implemented Interfaces:
DirectedGraph
Direct Known Subclasses:
BriefUnitGraph, CompleteUnitGraph, TrapUnitGraph

public class UnitGraph
extends java.lang.Object
implements DirectedGraph

Represents a CFG where the nodes are Unit instances.

See Also:
Unit, BriefUnitGraph

Field Summary
protected  Body body
           
protected  SootMethod method
           
protected  Chain unitChain
           
protected  java.util.Map unitToPreds
           
protected  java.util.Map unitToSuccs
           
 
Constructor Summary
UnitGraph(Body unitBody, boolean addExceptionEdges)
          Constructs a graph for the units found in the provided Body instance.
UnitGraph(Body unitBody, boolean addExceptionEdges, boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
          Constructs a graph for the units found in the provided Body instance.
 
Method Summary
 Body getBody()
           
 java.util.List getExtendedBasicBlockPathBetween(Unit from, Unit to)
          Look for a path in graph, from def to use.
 java.util.List getHeads()
          Returns a list of entry points for this graph.
 java.util.List getPredsOf(java.lang.Object s)
          Returns a list of predecessors for the given node in the graph.
 java.util.List getSuccsOf(java.lang.Object s)
          Returns a list of successors for the given node in the graph.
 java.util.List getTails()
          Returns a list of exit points for this graph.
 java.util.Iterator iterator()
          Returns an iterator for the nodes in this graph.
 int size()
          Returns the node count for this graph.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

unitToSuccs

protected java.util.Map unitToSuccs

unitToPreds

protected java.util.Map unitToPreds

method

protected SootMethod method

body

protected Body body

unitChain

protected Chain unitChain
Constructor Detail

UnitGraph

public UnitGraph(Body unitBody,
                 boolean addExceptionEdges)
Constructs a graph for the units found in the provided Body instance. Each node in the graph corresponds to a unit. The edges are derived from the control flow.

Parameters:
addExceptionEdges - If true then the control flow edges associated with exceptions are added.
See Also:
Body, Unit

UnitGraph

public UnitGraph(Body unitBody,
                 boolean addExceptionEdges,
                 boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
Constructs a graph for the units found in the provided Body instance. Each node in the graph corresponds to a unit. The edges are derived from the control flow.

Parameters:
addExceptionEdges - If true then the control flow edges associated with exceptions are added.
dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock - This was added for Dava. If true, edges are not added from statement before area of protection to catch. If false, edges ARE added. For Dava, it should be true. For flow analyses, it should be false.
See Also:
Body, Unit
Method Detail

getBody

public Body getBody()
Returns:
The underlying body instance this UnitGraph was built from.
See Also:
UnitGraph, Body

getExtendedBasicBlockPathBetween

public java.util.List getExtendedBasicBlockPathBetween(Unit from,
                                                       Unit to)
Look for a path in graph, from def to use. This path has to lie inside an extended basic block (and this property implies uniqueness.). The path returned includes from and to.

Parameters:
from - start point for the path.
to - end point for the path.
Returns:
null if there is no such path.

getHeads

public java.util.List getHeads()
Description copied from interface: DirectedGraph
Returns a list of entry points for this graph.

Specified by:
getHeads in interface DirectedGraph

getTails

public java.util.List getTails()
Description copied from interface: DirectedGraph
Returns a list of exit points for this graph.

Specified by:
getTails in interface DirectedGraph

getPredsOf

public java.util.List getPredsOf(java.lang.Object s)
Description copied from interface: DirectedGraph
Returns a list of predecessors for the given node in the graph.

Specified by:
getPredsOf in interface DirectedGraph

getSuccsOf

public java.util.List getSuccsOf(java.lang.Object s)
Description copied from interface: DirectedGraph
Returns a list of successors for the given node in the graph.

Specified by:
getSuccsOf in interface DirectedGraph

size

public int size()
Description copied from interface: DirectedGraph
Returns the node count for this graph.

Specified by:
size in interface DirectedGraph

iterator

public java.util.Iterator iterator()
Description copied from interface: DirectedGraph
Returns an iterator for the nodes in this graph. No specific ordering of the nodes is guaranteed.

Specified by:
iterator in interface DirectedGraph

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object