|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoot.Transformer
soot.SceneTransformer
ptolemy.copernicus.java.ModelTransformer
public class ModelTransformer
A transformer that creates a class to represent the model specified in the constructor. This transformer creates instance classes for each actor in the model, and generates code for composite actors that instantiates singleton instances of those classes. Additionally code is generated in composite actor classes to create links and relations between actors.
The class generates code for composite actors itself. For atomic actors, it defers to various implementations of the AtomicActorCreator class. This allows customized code to be generated for various atomic actors. By default, this class defers to a GenericAtomicActorCreator. That creator simply copies the existing actor specification code and specializes it.
Red (cxh) |
Red (cxh) |
Method Summary | |
---|---|
static NamedObj |
_findDeferredInstance(NamedObj object)
Return an instance that represents the class that the given object defers to. |
static boolean |
_isIgnorableAttribute(Attribute attribute)
|
static java.util.List |
actorClassList()
Return the list of classes that correspond to actors. |
static void |
addActorForClass(soot.SootClass theClass,
Entity entity)
Associate the given class, which has been created, with the given attribute. |
static void |
addAttributeForClass(soot.SootClass theClass,
Attribute attribute)
Associate the given class, which has been created, with the given attribute. |
static void |
addFieldForEntity(soot.SootField field,
Entity entity)
Assert that the given field always points to the given entity. |
static void |
addFieldForObject(soot.SootField field,
NamedObj object)
Assert that the given field always points to the given object. |
static java.util.List |
attributeClassList()
Return the list of classes that correspond to attributes. |
static void |
computeAttributesBefore(soot.jimple.JimpleBody body,
soot.jimple.Stmt insertPoint,
NamedObj context,
soot.Local contextLocal,
NamedObj namedObj,
soot.Local namedObjLocal,
soot.SootClass theClass,
java.util.List attributeList)
Generate code in the given body of the given class before the given statement to compute the values of the given list of attributes. |
static void |
createAttributeComputationFunctions(NamedObj context,
NamedObj namedObj,
soot.SootClass theClass,
ConstVariableModelAnalysis constAnalysis)
Create a method in the given class for each variables or settable attributes in the given namedObj that will compute the value of the variables and settable attributes and set the token for the associated parameter. |
static void |
createAttributes(soot.jimple.JimpleBody body,
NamedObj context,
soot.Local contextLocal,
NamedObj namedObj,
soot.Local namedObjLocal,
soot.SootClass theClass,
java.util.HashMap objectNameToCreatorName)
Generate code in the given body of the given class to create attributes contained by the given named object. |
static void |
createPorts(soot.jimple.JimpleBody body,
soot.Local contextLocal,
Entity context,
soot.Local entityLocal,
Entity entity,
EntitySootClass theClass,
java.util.HashMap objectNameToCreatorName)
Generate code in the given body of the given class to create ports contained by the given entity. |
static Entity |
getActorForClass(soot.SootClass theClass)
Return the entity for the given class if the given class is a class being generated, or null if not. |
static java.lang.String |
getAttributeComputationFunctionName(Attribute attribute,
NamedObj context)
Return the name of the method that is created to compute the current value of a variable. |
static Attribute |
getAttributeForClass(soot.SootClass theClass)
|
static soot.SootClass |
getClassForActor(Entity entity)
Return the entity for the given class if the given class is a class being generated, or null if not. |
static soot.SootClass |
getClassForObject(NamedObj object)
Return the entity for the given class if the given class is a class being generated, or null if not. |
static java.lang.String |
getContainerFieldName()
Return the name of the field that references the container of a generated class. |
java.lang.String |
getDeclaredOptions()
|
java.lang.String |
getDefaultOptions()
|
static Entity |
getEntityForField(soot.SootField field)
Given an entity that we are generating code for, return a reference to the instance field created for that entity. |
static java.lang.String |
getFieldNameForAttribute(Attribute attribute,
NamedObj context)
Return the name of the field that is created for the given entity. |
static java.lang.String |
getFieldNameForEntity(Entity entity,
NamedObj context)
Return the name of the field that is created for the given entity. |
static java.lang.String |
getFieldNameForPort(Port port,
NamedObj context)
Return the name of the field that is created for the given entity. |
static java.lang.String |
getFieldNameForRelation(Relation relation,
NamedObj context)
Return the name of the field that is created for the given entity. |
static java.lang.String |
getInstanceClassName(NamedObj object,
java.util.Map options)
Return the name of the class that is generated for the given named object. |
static soot.SootClass |
getModelClass()
Return the model class created during the most recent execution of this transformer. |
static java.lang.String |
getModelClassName(CompositeActor model,
java.util.Map options)
Return the name of the class that will be created for the given model. |
static NamedObj |
getObjectForClass(soot.SootClass theClass)
Return the object that the given class was generated for. |
java.lang.String |
getPhaseName()
|
static void |
implementExecutableInterface(soot.SootClass theClass)
Transform the given class so that it properly implements the ptolemy Executable interface. |
static void |
initializeAttributesBefore(soot.jimple.JimpleBody body,
soot.jimple.Stmt insertPoint,
NamedObj context,
soot.Local contextLocal,
NamedObj namedObj,
soot.Local namedObjLocal,
soot.SootClass theClass)
Generate code in the given body of the given class before the given statement to set the values of variables and settable attributes contained by the given named object. |
static void |
inlineLocalCalls(soot.SootClass theClass)
Inline invocation sites from methods in the given class to another method in the given class that are problematic. |
protected void |
internalTransform(java.lang.String phaseName,
java.util.Map options)
|
static boolean |
isActorClass(soot.SootClass theClass)
Return true if the given class was generated for an actor in the model |
static void |
updateCreatedSet(java.lang.String prefix,
NamedObj context,
NamedObj object,
java.util.HashMap objectNameToCreatorName)
Add the full names of all named objects contained in the given object to the given set, assuming that the object is contained within the given context. |
static ModelTransformer |
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 |
---|
public static ModelTransformer v(CompositeActor model)
public static void computeAttributesBefore(soot.jimple.JimpleBody body, soot.jimple.Stmt insertPoint, NamedObj context, soot.Local contextLocal, NamedObj namedObj, soot.Local namedObjLocal, soot.SootClass theClass, java.util.List attributeList)
body
- The body to generate code in.insertPoint
- A statement in the given body.context
- The named object corresponding to the class in which
code is being generated.contextLocal
- A local in the given body that points to
an instance of the given class.namedObj
- The named object that contains attributes.namedObjLocal
- A local in the given body. Attributes will be
created using this local as the container.theClass
- The soot class being modified.attributeList
- The list of attributes.public static void createAttributes(soot.jimple.JimpleBody body, NamedObj context, soot.Local contextLocal, NamedObj namedObj, soot.Local namedObjLocal, soot.SootClass theClass, java.util.HashMap objectNameToCreatorName)
body
- The body to generate code in.context
- The named object corresponding to the class in which
code is being generated.contextLocal
- A local in the given body that points to
an instance of the given class.namedObj
- The named object that contains attributes.namedObjLocal
- A local in the given body. Attributes will be
created using this local as the container.theClass
- The soot class being modified.objectNameToCreatorName
- A map from full names of
objects to the full name of the object that created that
object.public static void createPorts(soot.jimple.JimpleBody body, soot.Local contextLocal, Entity context, soot.Local entityLocal, Entity entity, EntitySootClass theClass, java.util.HashMap objectNameToCreatorName)
body
- The body to generate code in.context
- The named object corresponding to the class in which
code is being generated.contextLocal
- A local in the given body that points to
an instance of the given class.entity
- The entity that contains ports.entityLocal
- A local in the given body. Ports will be
created using this local as the container.theClass
- The soot class being modified.objectNameToCreatorName
- A map from full names of
objects to the full name of the object that created that
object.public static void createAttributeComputationFunctions(NamedObj context, NamedObj namedObj, soot.SootClass theClass, ConstVariableModelAnalysis constAnalysis)
context
- The named object corresponding to the class in which
code is being generated.namedObj
- The named object that contains attributes.theClass
- The soot class being modified.constAnalysis
- Analysis that is used to determine parameter
dependencies.public static void initializeAttributesBefore(soot.jimple.JimpleBody body, soot.jimple.Stmt insertPoint, NamedObj context, soot.Local contextLocal, NamedObj namedObj, soot.Local namedObjLocal, soot.SootClass theClass)
body
- The body to generate code in.insertPoint
- A statement in the given body.context
- The named object corresponding to the class in which
code is being generated.contextLocal
- A local in the given body that points to
an instance of the given class.namedObj
- The named object that contains attributes.namedObjLocal
- A local in the given body. Attributes will be
created using this local as the container.theClass
- The soot class being modified.public java.lang.String getPhaseName()
getPhaseName
in interface soot.HasPhaseOptions
public java.lang.String getDefaultOptions()
getDefaultOptions
in interface soot.HasPhaseOptions
public java.lang.String getDeclaredOptions()
getDeclaredOptions
in interface soot.HasPhaseOptions
public static java.lang.String getAttributeComputationFunctionName(Attribute attribute, NamedObj context)
public static java.lang.String getFieldNameForAttribute(Attribute attribute, NamedObj context)
public static java.lang.String getFieldNameForEntity(Entity entity, NamedObj context)
public static Entity getEntityForField(soot.SootField field)
java.lang.RuntimeException
- If no field was created for the
given entity.public static void addFieldForEntity(soot.SootField field, Entity entity)
public static void addFieldForObject(soot.SootField field, NamedObj object)
public static java.lang.String getFieldNameForPort(Port port, NamedObj context)
public static java.lang.String getFieldNameForRelation(Relation relation, NamedObj context)
public static Entity getActorForClass(soot.SootClass theClass)
public static soot.SootClass getClassForActor(Entity entity)
public static soot.SootClass getClassForObject(NamedObj object)
public static boolean isActorClass(soot.SootClass theClass)
public static void addAttributeForClass(soot.SootClass theClass, Attribute attribute)
public static void addActorForClass(soot.SootClass theClass, Entity entity)
public static java.util.List actorClassList()
public static java.util.List attributeClassList()
public static NamedObj getObjectForClass(soot.SootClass theClass)
public static Attribute getAttributeForClass(soot.SootClass theClass)
java.lang.RuntimeException
- If no field was created for the
given attribute.public static java.lang.String getInstanceClassName(NamedObj object, java.util.Map options)
public static soot.SootClass getModelClass()
public static java.lang.String getModelClassName(CompositeActor model, java.util.Map options)
public static java.lang.String getContainerFieldName()
public static void implementExecutableInterface(soot.SootClass theClass)
theClass
- The class to transform.public static void inlineLocalCalls(soot.SootClass theClass)
theClass
- The class to transform.public static void updateCreatedSet(java.lang.String prefix, NamedObj context, NamedObj object, java.util.HashMap objectNameToCreatorName)
prefix
- The full name of the context in the model.context
- The context.object
- The object being recorded.objectNameToCreatorName
- A map from full names of
objects to the full name of the object that created that
object.protected void internalTransform(java.lang.String phaseName, java.util.Map options)
internalTransform
in class soot.SceneTransformer
public static NamedObj _findDeferredInstance(NamedObj object)
public static boolean _isIgnorableAttribute(Attribute attribute)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |