soot.toolkits.graph
Class BlockGraph

java.lang.Object
  |
  +--soot.toolkits.graph.BlockGraph
All Implemented Interfaces:
DirectedGraph
Direct Known Subclasses:
ArrayRefBlockGraph, BriefBlockGraph, CompleteBlockGraph, ZonedBlockGraph

public class BlockGraph
extends java.lang.Object
implements DirectedGraph

Implements a CFG for a Body instance where the nodes are Block instances. It is a generic implementation used by more specific classes such as BriefBlockGraph.

See Also:
BriefBlockGraph, CompleteBlockGraph, ZonedBlockGraph, ArrayRefBlockGraph

Field Summary
static int ARRAYREF
           
static int BRIEF
           
static int COMPLETE
           
static int ZONED
           
 
Constructor Summary
BlockGraph(Body aBody, int type)
          Constructs a BriefBlockGraph from a given Body instance.
 
Method Summary
 java.util.List getBlocks()
          Returns a list of the Blocks composing this graph.
 Body getBody()
          Returns the underlying Body instance this BlockGraph is derived from.
 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

COMPLETE

public static final int COMPLETE
See Also:
Constant Field Values

BRIEF

public static final int BRIEF
See Also:
Constant Field Values

ZONED

public static final int ZONED
See Also:
Constant Field Values

ARRAYREF

public static final int ARRAYREF
See Also:
Constant Field Values
Constructor Detail

BlockGraph

public BlockGraph(Body aBody,
                  int type)
Constructs a BriefBlockGraph from a given Body instance.

Parameters:
aBody - The Body instance we want a graph for.
type - Specifies the type of graph to build. This can be BRIEF, ZONED or COMPLETE.
See Also:
CompleteBlockGraph, BriefBlockGraph, ZonedBlockGraph, ArrayRefBlockGraph
Method Detail

getBody

public Body getBody()
Returns the underlying Body instance this BlockGraph is derived from.

Returns:
The underlying Body instance this BlockGraph is derived from.
See Also:
BlockGraph, Body

getBlocks

public java.util.List getBlocks()
Returns a list of the Blocks composing this graph.

Returns:
A list of the blocks composing this graph in the same order as they partition underlying Body instance's unitchain.
See Also:
Block

toString

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

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