ptolemy.copernicus.c
Class InstanceOfFunctionGenerator

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

public class InstanceOfFunctionGenerator
extends java.lang.Object

A class that generates code that performs lookup operations to implement the "instanceof" operator. It generates a function for each class C that takes the argument as the hashNumber corresponding to some class/interface A and returns 1 if C is an instance of A.

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

Constructor Summary
InstanceOfFunctionGenerator()
           
 
Method Summary
 java.lang.String generate(soot.SootClass source)
          Generate code for a method that looks up the number corresponding to the given interface/class in a table and returns 1 if this class is an instance of that interface/class, 0 otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceOfFunctionGenerator

public InstanceOfFunctionGenerator()
Method Detail

generate

public java.lang.String generate(soot.SootClass source)
Generate code for a method that looks up the number corresponding to the given interface/class in a table and returns 1 if this class is an instance of that interface/class, 0 otherwise. Essentially, it returns whether the source class can be cast as a given class/interface.

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