ptolemy.copernicus.c
Class InterfaceLookupGenerator

java.lang.Object
  extended by ptolemy.copernicus.c.InterfaceLookupGenerator

public class InterfaceLookupGenerator
extends java.lang.Object

A class that generates code that performs lookup operations for disambiguation of interfaces.

Since:
Ptolemy II 4.0
Version:
$Id: InterfaceLookupGenerator.java,v 1.27 2005/07/08 19:56:58 cxh Exp $
Author:
Ankush Varma
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (ankush)

Constructor Summary
InterfaceLookupGenerator()
          Default Constructor.
 
Method Summary
 java.lang.String generate(soot.SootClass source)
          Generate code for a method that looks up interface method calls in a table and calls the correct function accordingly.
static java.util.HashMap getLookupMethods(soot.SootClass source)
          Returns the list of all methods that may need to be looked up.
static boolean needsLookupFunction(soot.SootClass source)
          Finds out whether a class needs a lookup function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceLookupGenerator

public InterfaceLookupGenerator()
Default Constructor.

Method Detail

generate

public java.lang.String generate(soot.SootClass source)
Generate code for a method that looks up interface method calls in a table and calls the correct function accordingly.

Parameters:
source - The class for which such a method needs to be generated.
Returns:
The code for the method.

getLookupMethods

public static java.util.HashMap getLookupMethods(soot.SootClass source)
Returns the list of all methods that may need to be looked up. Provides a mapping from the interface's method to the corresponding method in the class that implements it.

Parameters:
source - The class for which this set is to be generated.
Returns:
The set of all methods that may need to be looked up.

needsLookupFunction

public static boolean needsLookupFunction(soot.SootClass source)
Finds out whether a class needs a lookup function.

Parameters:
source - The class.
Returns:
True if the class has at least one required method (@see RequiredFileGenerator.isRequired) that is defined in an interface implemented by the class.