ptolemy.copernicus.java
Class FieldsForEntitiesTransformer

java.lang.Object
  extended by soot.Transformer
      extended by soot.SceneTransformer
          extended by ptolemy.copernicus.java.FieldsForEntitiesTransformer
All Implemented Interfaces:
soot.HasPhaseOptions

public class FieldsForEntitiesTransformer
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A transformer that is responsible for replacing references to entities. Any calls to the getContainer(), and getEntity() methods are replaced with a field reference to the field of the appropriate class. FIXME: deal with this also?

Since:
Ptolemy II 2.0
Version:
$Id: FieldsForEntitiesTransformer.java,v 1.51 2006/12/19 18:31:28 cxh Exp $
Author:
Stephen Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Method Summary
static void _createContainerField(soot.SootClass theClass)
           
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
static Entity getEntityContainerOfObject(Nameable object)
          Given an object in the model, return the first object above it in the hierarchy that is an entity.
static soot.Local getLocalReferenceForEntity(Entity entity, soot.SootClass sourceClass, soot.Local local, soot.jimple.JimpleBody body, soot.Unit unit, java.util.Map options)
          Insert code into the given body of a method in the given class before the given unit to get a reference to the object generated for the given entity.
 java.lang.String getPhaseName()
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
           
static boolean isContained(Nameable object1, Nameable object2)
          Return true if the first object is contained in the second.
static boolean isDeeplyContained(Nameable object1, Nameable object2)
          Return true if the first object is contained in the second.
static FieldsForEntitiesTransformer v(CompositeActor model)
          Return an instance of this transformer that will operate on the given model.
 
Methods inherited from class soot.SceneTransformer
transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

v

public static FieldsForEntitiesTransformer v(CompositeActor model)
Return an instance of this transformer that will operate on the given model. The model is assumed to already have been properly initialized so that resolved types and other static properties of the model can be inspected.


getPhaseName

public java.lang.String getPhaseName()
Specified by:
getPhaseName in interface soot.HasPhaseOptions

getDefaultOptions

public java.lang.String getDefaultOptions()
Specified by:
getDefaultOptions in interface soot.HasPhaseOptions

getDeclaredOptions

public java.lang.String getDeclaredOptions()
Specified by:
getDeclaredOptions in interface soot.HasPhaseOptions

getEntityContainerOfObject

public static Entity getEntityContainerOfObject(Nameable object)
Given an object in the model, return the first object above it in the hierarchy that is an entity. If the object is itself an entity, then simply return its container.


isContained

public static boolean isContained(Nameable object1,
                                  Nameable object2)
Return true if the first object is contained in the second.


isDeeplyContained

public static boolean isDeeplyContained(Nameable object1,
                                        Nameable object2)
Return true if the first object is contained in the second.


getLocalReferenceForEntity

public static soot.Local getLocalReferenceForEntity(Entity entity,
                                                    soot.SootClass sourceClass,
                                                    soot.Local local,
                                                    soot.jimple.JimpleBody body,
                                                    soot.Unit unit,
                                                    java.util.Map options)
Insert code into the given body of a method in the given class before the given unit to get a reference to the object generated for the given entity.

Throws:
java.lang.RuntimeException - If no field was created for the given entity.

internalTransform

protected void internalTransform(java.lang.String phaseName,
                                 java.util.Map options)
Specified by:
internalTransform in class soot.SceneTransformer

_createContainerField

public static void _createContainerField(soot.SootClass theClass)