Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class LoadedCallGraph  view LoadedCallGraph download LoadedCallGraph.java

java.lang.Object
  extended byjava.util.AbstractMap
      extended byUtil.Collections.UnmodifiableMultiMap
          extended byCompil3r.Quad.CallGraph
              extended byCompil3r.Quad.LoadedCallGraph
All Implemented Interfaces:
Util.Collections.BinaryRelation, Util.Graphs.Graph, java.util.Map, Util.Collections.MultiMap

public class LoadedCallGraph
extends CallGraph

A call graph that is loaded from a file.

Version:
$Id: LoadedCallGraph.java,v 1.4 2003/07/22 22:38:47 joewhaley Exp $

Nested Class Summary
 
Nested classes inherited from class Compil3r.Quad.CallGraph
CallGraph.CallGraphMap, CallGraph.CallGraphNavigator, CallGraph.CallSiteMap, CallGraph.CallTargetMap
 
Nested classes inherited from class java.util.AbstractMap
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  Util.Collections.MultiMap callSites
           
protected  Util.Collections.InvertibleMultiMap edges
           
protected  java.util.Set methods
           
protected  java.util.Set roots
           
 
Fields inherited from class Util.Collections.UnmodifiableMultiMap
DEFAULT_HISTOGRAM_SIZE
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
LoadedCallGraph(java.lang.String filename)
           
 
Method Summary
 void add(Clazz.jq_Method caller, int bcIndex, Clazz.jq_Method callee)
           
 java.util.Set entrySet()
          Returns a Set view that allows you to recapture the MultiMap view.
 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(Clazz.jq_Method caller)
          Returns the set of methods that are called by the given method.
 java.util.Collection getCallers(Clazz.jq_Method callee)
          Returns the set of methods that can call the given method.
 java.util.Collection getCallSites(Clazz.jq_Method caller)
          Returns the set of call sites in the given method.
 java.util.Collection getRoots()
           
 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()
          Returns a set view of the keys in this Map.
protected  void read(java.io.BufferedReader in)
           
 void setRoots(java.util.Collection roots)
          Sets up the root methods to be the given set.
static void write(CallGraph cg, java.io.PrintWriter out)
           
 
Methods inherited from class Compil3r.Quad.CallGraph
calculateBackEdges, calculateEdgeRelation, calculateReachableMethods, contains, findDepths, getCallees, getCallGraphMap, getCallSiteMap, getCallSites, getCallSites0, getCallSites0, getCallSites1, getNavigator, getTargetMethod, getTargetMethods, getValues, numberOfTargetMethods, numberOfTargetMethods, toString
 
Methods inherited from class Util.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 Util.Collections.MultiMap
get, size
 
Methods inherited from interface java.util.Map
containsKey, containsValue, equals, hashCode, isEmpty, values
 

Field Detail

methods

protected java.util.Set methods

roots

protected java.util.Set roots

callSites

protected Util.Collections.MultiMap callSites

edges

protected Util.Collections.InvertibleMultiMap edges
Constructor Detail

LoadedCallGraph

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

write

public static void write(CallGraph cg,
                         java.io.PrintWriter out)
                  throws java.io.IOException

read

protected void read(java.io.BufferedReader in)
             throws java.io.IOException

add

public void add(Clazz.jq_Method caller,
                int bcIndex,
                Clazz.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

getRoots

public java.util.Collection getRoots()
Specified by:
getRoots in interface Util.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

entrySet

public java.util.Set entrySet()
Description copied from class: Util.Collections.UnmodifiableMultiMap
Returns a Set view that allows you to recapture the MultiMap view.

Specified by:
entrySet in interface Util.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

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

getCallees

public java.util.Collection getCallees(Clazz.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

getCallers

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

Overrides:
getCallers in class CallGraph

getCallSites

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

Overrides:
getCallSites in class CallGraph

keySet

public java.util.Set keySet()
Description copied from interface: java.util.Map
Returns a set view of the keys in this Map. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this set.