joeq.Compiler.Quad
Class LoadedCallGraph

java.lang.Object
  extended by java.util.AbstractMap
      extended by jwutil.collections.UnmodifiableMultiMap
          extended by joeq.Compiler.Quad.CallGraph
              extended by joeq.Compiler.Quad.LoadedCallGraph
All Implemented Interfaces:
Map, jwutil.collections.BinaryRelation, jwutil.collections.MultiMap, jwutil.graphs.Graph

public class LoadedCallGraph
extends CallGraph

A call graph that is loaded from a file.

Version:
$Id: LoadedCallGraph.java 2456 2006-04-06 02:31:41Z mcmartin $
Author:
John Whaley

Nested Class Summary
static class LoadedCallGraph.SortedArraySetFactory
           
 
Nested classes/interfaces inherited from class joeq.Compiler.Quad.CallGraph
CallGraph.CallGraphCSNavigator, CallGraph.CallGraphMap, CallGraph.CallGraphMethodNavigator, CallGraph.CallSiteMap, CallGraph.CallTargetMap
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  boolean bcCallSites
           
static Comparator callsite_comparator
           
protected  jwutil.collections.MultiMap callSites
           
protected  jwutil.collections.InvertibleMultiMap edges
           
static Comparator member_comparator
           
protected  Set methods
           
protected  Set roots
           
static LoadedCallGraph.SortedArraySetFactory sortedArraySetFactory
           
static jwutil.collections.MapFactory treeMapFactory
           
static Comparator type_comparator
           
 
Fields inherited from class jwutil.collections.UnmodifiableMultiMap
DEFAULT_HISTOGRAM_SIZE
 
Constructor Summary
LoadedCallGraph(String filename)
           
 
Method Summary
 void add(jq_Method caller, int bcIndex, jq_Method callee)
           
 Set entrySet()
           
 Collection getAllCallSites()
          Returns the collection of all call sites in the call graph.
 Collection getAllMethods()
          Returns the collection of all methods in the call graph.
 Collection getCallees(jq_Method caller)
          Returns the set of methods that are called by the given method.
 Collection getCallerMethods(jq_Method callee)
          Returns the set of methods that can call the given method.
 Collection getCallers(jq_Method callee)
          Returns the set of call sites that can call the given method.
 Collection getCallSites(jq_Method caller)
          Returns the set of call sites in the given method.
 Collection getRoots()
          Returns the collection of root methods for this call graph.
 Collection getTargetMethods(Object context, ProgramLocation callSite)
          Returns the possible target methods of the given call site under the given context.
 Set keySet()
           
static ProgramLocation mapCall(ProgramLocation callSite)
           
protected  void read(DataInput in)
           
 void setRoots(Collection roots)
          Sets up the root methods to be the given set.
static void write(CallGraph cg, BufferedWriter out)
           
 
Methods inherited from class joeq.Compiler.Quad.CallGraph
calculateCallerRelation, calculateEdgeRelation, calculateReachableMethods, contains, findDepths, getCallees, getCallGraphMap, getCallSiteMap, getCallSiteNavigator, getCallSites, getCallSites0, getCallSites0, getCallSites1, getMethodNavigator, getNavigator, getTargetMethod, getTargetMethods, getValues, makeCallGraph, numberOfTargetMethods, numberOfTargetMethods, toString
 
Methods inherited from class jwutil.collections.UnmodifiableMultiMap
add, addAll, addAll, clear, computeHistogram, computeHistogram, entrySetHelper, proxy, put, putAll, remove, remove, removeAll, retainAll
 
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, get, hashCode, isEmpty, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jwutil.collections.MultiMap
get, size
 
Methods inherited from interface java.util.Map
containsKey, containsValue, equals, hashCode, isEmpty, values
 

Field Detail

type_comparator

public static Comparator type_comparator

member_comparator

public static Comparator member_comparator

callsite_comparator

public static Comparator callsite_comparator

treeMapFactory

public static final jwutil.collections.MapFactory treeMapFactory

sortedArraySetFactory

public static final LoadedCallGraph.SortedArraySetFactory sortedArraySetFactory

methods

protected Set methods

roots

protected Set roots

callSites

protected jwutil.collections.MultiMap callSites

edges

protected jwutil.collections.InvertibleMultiMap edges

bcCallSites

protected boolean bcCallSites
Constructor Detail

LoadedCallGraph

public LoadedCallGraph(String filename)
                throws IOException
Throws:
IOException
Method Detail

write

public static void write(CallGraph cg,
                         BufferedWriter out)
                  throws IOException
Throws:
IOException

read

protected void read(DataInput in)
             throws IOException
Throws:
IOException

add

public void add(jq_Method caller,
                int bcIndex,
                jq_Method callee)

setRoots

public void setRoots(Collection roots)
Description copied from class: CallGraph
Sets up the root methods to be the given set. Later call graph queries use the value that you pass in here. Implementing this method is optional -- it is only necessary if you use methods that require a root set, like getReachableMethods().

Specified by:
setRoots in class CallGraph
Parameters:
roots - collection of root methods

getRoots

public Collection getRoots()
Description copied from class: CallGraph
Returns the collection of root methods for this call graph.

Specified by:
getRoots in interface jwutil.graphs.Graph
Specified by:
getRoots in class CallGraph

getTargetMethods

public Collection getTargetMethods(Object context,
                                   ProgramLocation callSite)
Description copied from class: CallGraph
Returns the possible target methods of the given call site under the given context. The interpretation of the context object is specific to the type of call graph.

Specified by:
getTargetMethods in class CallGraph
Returns:
Collection of jq_Methods that are the possible targets

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in interface jwutil.collections.MultiMap
Overrides:
entrySet in class CallGraph

getAllCallSites

public Collection getAllCallSites()
Description copied from class: CallGraph
Returns the collection of all call sites in the call graph. The default implementation just iterates through all of the methods to build up the collection.

Overrides:
getAllCallSites in class CallGraph
Returns:
Collection of all call sites in the call graph

getAllMethods

public Collection getAllMethods()
Description copied from class: CallGraph
Returns the collection of all methods in the call graph. The default implementation recalculates the reachable methods based on the root set.

Overrides:
getAllMethods in class CallGraph
Returns:
Collection of all call sites in the call graph

getCallees

public Collection getCallees(jq_Method caller)
Description copied from class: CallGraph
Returns the set of methods that are called by the given method.

Overrides:
getCallees in class CallGraph
Returns:
set of callee methods

getCallers

public Collection getCallers(jq_Method callee)
Description copied from class: CallGraph
Returns the set of call sites that can call the given method.

Overrides:
getCallers in class CallGraph
Returns:
set of callers

getCallerMethods

public Collection getCallerMethods(jq_Method callee)
Description copied from class: CallGraph
Returns the set of methods that can call the given method.

Overrides:
getCallerMethods in class CallGraph
Returns:
set of caller methods

getCallSites

public Collection getCallSites(jq_Method caller)
Description copied from class: CallGraph
Returns the set of call sites in the given method.

Overrides:
getCallSites in class CallGraph
Returns:
set of call sites

keySet

public Set keySet()
Specified by:
keySet in interface Map
Overrides:
keySet in class AbstractMap

mapCall

public static ProgramLocation mapCall(ProgramLocation callSite)


Copyright © 2001-2008 John Whaley. All Rights Reserved.