private static void _createActorsIn(CompositeActor model,
HashMap objectNameToCreatorName, String phaseName,
ConstVariableModelAnalysis constAnalysis, Map options) {
// Create an instance class for every actor.
for (Iterator i = model.deepEntityList().iterator(); i.hasNext();) {
Entity entity = (Entity) i.next();
String className = entity.getClass().getName();
String newClassName = getInstanceClassName(entity, options);
if (Scene.v().containsClass(newClassName)) {
continue;
}
System.out.println("ModelTransformer: Creating actor class "
+ newClassName);
System.out.println("for actor " + entity.getFullName());
System.out.println("based on " + className);
// FIXME the code below should probably copy the class and then
// add init stuff. EntitySootClass handles this nicely, but
// doesn't let us use copyClass. Generally adding this init crap
// is something we have to do a lot. How do we handle it nicely?
//
// SootClass newClass =
// SootUtilities.copyClass(entityClass, newClassName);
// newClass.setApplicationClass();
if (entity.getClass().getName().equals(
"ptolemy.actor.lib.MathFunction")) {
throw new RuntimeException(
"Code Generation for "
+ "ptolemy.actor.lib.MathFunction not supported, since "
+ "it dynamically creates ports.");
} else if (entity.getClass().getName().equals(
"ptolemy.actor.lib.ArraySort")
|| entity.getClass().getName().equals(
"ptolemy.actor.lib.ArrayPeakSearch")) {
throw new RuntimeException("Code Generation for "
+ "some actors not supported, since "
+ "they create ArrayTokens from lists.");
} else if (entity.getClass().getName().equals(
"ptolemy.actor.lib.TypeTest")) {
throw new RuntimeException("Code Generation for "
+ "ptolemy.actor.lib.TypeTest not supported, since "
+ "it walks around the model.");
} else if (entity.getClass().getName().equals(
"ptolemy.actor.lib.RecordAssembler")
|| entity.getClass().getName().equals(
"ptolemy.actor.lib.RecordDisassembler")
|| entity.getClass().getName().equals(
"ptolemy.actor.lib.BusAssembler")
|| entity.getClass().getName().equals(
"ptolemy.actor.lib.BusDisassembler")) {
throw new RuntimeException("Code Generation for "
+ "some actors not supported, since "
+ "they iterate over ports.");
} else if (entity.getClass().getName().equals(
"ptolemy.actor.lib.conversions.ExpressionToToken")
|| entity.getClass().getName().equals(
"ptolemy.actor.lib.io.ExpressionReader")) {
throw new RuntimeException("Code Generation for "
+ "some actors not supported, since "
+ "they have dynamic expressions.");
} else if (entity instanceof CompositeActor) {