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:
java.util.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,v 1.24 2006/04/06 02:31:41 mcmartin Exp $
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 class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.util.Comparator callsite_comparator
           
static java.util.Comparator member_comparator
           
static LoadedCallGraph.SortedArraySetFactory sortedArraySetFactory
           
static jwutil.collections.MapFactory treeMapFactory
           
static java.util.Comparator type_comparator
           
 
Fields inherited from class jwutil.collections.UnmodifiableMultiMap
DEFAULT_HISTOGRAM_SIZE
 
Constructor Summary
LoadedCallGraph(java.lang.String filename)
           
 
Method Summary
 void add(jq_Method caller, int bcIndex, jq_Method callee)
           
 java.util.Set entrySet()
           
 java.util.Collection getAllCallSites()
          Returns the collection of all call sites in the call graph.
 java.util.Collection getAllMethods()
          Returns the collection of all methods in the call graph.
 java.util.Collection getCallees(jq_Method caller)
          Returns the set of methods that are called by the given method.
 java.util.Collection getCallerMethods(jq_Method callee)
          Returns the set of methods that can call the given method.
 java.util.Collection getCallers(jq_Method callee)
          Returns the set of call sites that can call the given method.
 java.util.Collection getCallSites(jq_Method caller)
          Returns the set of call sites in the given method.
 java.util.Collection getRoots()
          Returns the collection of root methods for this call graph.
 java.util.Collection getTargetMethods(java.lang.Object context, ProgramLocation callSite)
          Returns the possible target methods of the given call site under the given context.
 java.util.Set keySet()
           
static ProgramLocation mapCall(ProgramLocation callSite)
           
 void setRoots(java.util.Collection roots)
          Sets up the root methods to be the given set.
static void write(CallGraph cg, java.io.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, proxy, put, putAll, remove, remove, removeAll, retainAll
 
Methods inherited from class java.util.AbstractMap
containsKey, containsValue, equals, get, hashCode, isEmpty, size, values
 
Methods inherited from class java.lang.Object
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 java.util.Comparator type_comparator

member_comparator

public static java.util.Comparator member_comparator

callsite_comparator

public static java.util.Comparator callsite_comparator

treeMapFactory

public static final jwutil.collections.MapFactory treeMapFactory

sortedArraySetFactory

public static final LoadedCallGraph.SortedArraySetFactory sortedArraySetFactory
Constructor Detail

LoadedCallGraph

public LoadedCallGraph(java.lang.String filename)
                throws java.io.IOException
Throws:
java.io.IOException
Method Detail

write

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

add

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

setRoots

public void setRoots(java.util.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 java.util.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 java.util.Collection getTargetMethods(java.lang.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 java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in interface jwutil.collections.MultiMap
Overrides:
entrySet in class CallGraph

getAllCallSites

public java.util.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 java.util.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 java.util.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 java.util.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 java.util.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 java.util.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 java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
Overrides:
keySet in class java.util.AbstractMap

mapCall

public static ProgramLocation mapCall(ProgramLocation callSite)