com.ibm.wala.ipa.callgraph.impl
Class DelegatingContextSelector

java.lang.Object
  extended by com.ibm.wala.ipa.callgraph.impl.DelegatingContextSelector
All Implemented Interfaces:
ContextSelector

public class DelegatingContextSelector
extends java.lang.Object
implements ContextSelector

A context selector that first checks with A, then defaults to B.


Constructor Summary
DelegatingContextSelector(ContextSelector A, ContextSelector B)
           
 
Method Summary
 boolean allSitesDispatchIdentically(CGNode node, CallSiteReference site)
           
 boolean contextIsIrrelevant(CGNode node, CallSiteReference site)
           
 int getBoundOnNumberOfTargets(CGNode caller, CallSiteReference site, IMethod targetMethod)
           
 Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey receiver)
          Given a call site, returns the Context in which the callee should be evaluated.
 boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance)
           
 void setWarnings(WarningSet newWarnings)
          Bind this object to a new object to track warnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingContextSelector

public DelegatingContextSelector(ContextSelector A,
                                 ContextSelector B)
Method Detail

getCalleeTarget

public Context getCalleeTarget(CGNode caller,
                               CallSiteReference site,
                               IMethod callee,
                               InstanceKey receiver)
Description copied from interface: ContextSelector
Given a call site, returns the Context in which the callee should be evaluated.

Specified by:
getCalleeTarget in interface ContextSelector
site - description of the call site
Returns:
the Context in which the callee should be evaluated, or null if no information is available.

getBoundOnNumberOfTargets

public int getBoundOnNumberOfTargets(CGNode caller,
                                     CallSiteReference site,
                                     IMethod targetMethod)
Specified by:
getBoundOnNumberOfTargets in interface ContextSelector
Returns:
a bound on the number of contexts that might be created for this target. -1 if no bound is known.

mayUnderstand

public boolean mayUnderstand(CGNode caller,
                             CallSiteReference site,
                             IMethod targetMethod,
                             InstanceKey instance)
Specified by:
mayUnderstand in interface ContextSelector
instance - the instance dispatched on. null means "any possible instance"
Returns:
true iff this object may understand how to select a context for the given target

setWarnings

public void setWarnings(WarningSet newWarnings)
Description copied from interface: ContextSelector
Bind this object to a new object to track warnings

Specified by:
setWarnings in interface ContextSelector

contextIsIrrelevant

public boolean contextIsIrrelevant(CGNode node,
                                   CallSiteReference site)
Specified by:
contextIsIrrelevant in interface ContextSelector
Returns:
true iff this context selector will always return the same context for a given call site, regardless of the receiver object

allSitesDispatchIdentically

public boolean allSitesDispatchIdentically(CGNode node,
                                           CallSiteReference site)
Specified by:
allSitesDispatchIdentically in interface ContextSelector
Returns:
true iff \forAll n \in nodes, \forAll s \in sites with this declaredTarget, the set of targets is the same