Examples of SootClass


Examples of soot.SootClass

 
  private  void setApplicationClasses(){
    Iterator<String> classIt = classes.iterator();
    while(classIt.hasNext()){
      String className = classIt.next().toString();
      SootClass current = Scene.v().getSootClass(className);
      current.setApplicationClass();
    }
  }
View Full Code Here

Examples of soot.SootClass

    String name = (String)JOptionPane.showInputDialog(
                this, "Enter name of main class",
                "Customized Dialog",JOptionPane.PLAIN_MESSAGE,
                null,null,null);
    try{
      SootClass mainClass = Scene.v().getSootClass(name);
      Scene.v().setMainClass(mainClass);
    }
    catch(Exception e){
      e.printStackTrace();
      selectMainClass();
View Full Code Here

Examples of soot.SootClass

 
  private  void setApplicationClasses(){
    Iterator classIt = classes.iterator();
    while(classIt.hasNext()){
      String className = classIt.next().toString();
      SootClass current = Scene.v().getSootClass(className);
      current.setApplicationClass();
    }
  }
View Full Code Here

Examples of soot.SootClass

    String name = (String)JOptionPane.showInputDialog(
                this, "Enter name of main class",
                "Customized Dialog",JOptionPane.PLAIN_MESSAGE,
                null,null,null);
    try{
      SootClass mainClass = Scene.v().getSootClass(name);
      Scene.v().setMainClass(mainClass);
    }
    catch(Exception e){
      e.printStackTrace();
      selectMainClass();
View Full Code Here

Examples of soot.SootClass

    protected void internalTransform(String phaseName, Map options) {
        System.out.println("FieldOptimizationTransformer.internalTransform("
                + phaseName + ", " + options + ")");

        SootClass stringClass = Scene.v().loadClassAndSupport(
                "java.lang.String");
        /*Type stringType =*/RefType.v(stringClass);
        SootClass objectClass = Scene.v().loadClassAndSupport(
                "java.lang.Object");
        /*SootMethod toStringMethod = */objectClass
                .getMethod("java.lang.String toString()");
        SootClass namedObjClass = Scene.v().loadClassAndSupport(
                "ptolemy.kernel.util.NamedObj");
        /*SootMethod getAttributeMethod = */namedObjClass
                .getMethod("ptolemy.kernel.util.Attribute getAttribute(java.lang.String)");
        /*SootMethod attributeChangedMethod = */namedObjClass
                .getMethod("void attributeChanged(ptolemy.kernel.util.Attribute)");

        SootClass attributeClass = Scene.v().loadClassAndSupport(
                "ptolemy.kernel.util.Attribute");
        /*Type attributeType = */RefType.v(attributeClass);
        SootClass settableClass = Scene.v().loadClassAndSupport(
                "ptolemy.kernel.util.Settable");
        /*Type settableType = */RefType.v(settableClass);
        /*SootMethod getExpressionMethod = */settableClass
                .getMethod("java.lang.String getExpression()");
        /*SootMethod setExpressionMethod = */settableClass
                .getMethod("void setExpression(java.lang.String)");

        SootClass tokenClass = Scene.v().loadClassAndSupport(
                "ptolemy.data.Token");
        /*Type tokenType = */RefType.v(tokenClass);
        SootClass parameterClass = Scene.v().loadClassAndSupport(
                "ptolemy.data.expr.Variable");
        /*SootMethod getTokenMethod = */parameterClass
                .getMethod("ptolemy.data.Token getToken()");
        /*SootMethod setTokenMethod = */parameterClass
                .getMethod("void setToken(ptolemy.data.Token)");

        // Loop over all the actor instance classes.
        for (Iterator i = _model.deepEntityList().iterator(); i.hasNext();) {
            Entity entity = (Entity) i.next();
            String className = PhaseOptions.getString(options, "targetPackage")
                    + "." + entity.getName();
            SootClass entityClass = Scene.v().loadClassAndSupport(className);

            for (Iterator fields = entityClass.getFields().iterator(); fields
                    .hasNext();) {
                SootField field = (SootField) fields.next();

                // FIXME: static fields too.
                if (Modifier.isStatic(field.getModifiers())) {
                    continue;
                }

                boolean finalize = true;
                Value fieldValue = null;

                for (Iterator methods = entityClass.getMethods().iterator(); (methods
                        .hasNext() && finalize);) {
                    SootMethod method = (SootMethod) methods.next();

                    if (method.getName().equals("<init>")) {
                        Chain units = method.retrieveActiveBody().getUnits();
View Full Code Here

Examples of soot.SootClass

        System.out.println("InlineTokenTransformer.internalTransform("
                + phaseName + ", " + options + ")");

        for (Iterator classes = Scene.v().getApplicationClasses().iterator(); classes
                .hasNext();) {
            SootClass theClass = (SootClass) classes.next();
            _inlineTokenCalls(theClass);
        }
    }
View Full Code Here

Examples of soot.SootClass

                    Type returnType = r.getMethod().getReturnType();

                    if (returnType instanceof ArrayType) {
                    } else if (returnType instanceof RefType) {
                        SootClass returnClass = ((RefType) returnType)
                                .getSootClass();

                        if (SootUtilities.derivesFrom(returnClass,
                                PtolemyUtilities.tokenClass)) {
                            if (_debug) {
                                System.out.println("handling as token type");
                            }

                            Local local = PtolemyUtilities
                                    .buildConstantTokenLocal(body, unit,
                                            (Token) object, "token");
                            box.setValue(local);
                            doneSomething = true;
                        } else if (returnClass.getName().equals(
                                "java.lang.String")) {
                            if (_debug) {
                                System.out.println("handling as string type");
                            }
View Full Code Here

Examples of soot.SootClass

     *  necessary.  The given entity is assumed to be an expression actor.
     */
    public SootClass createAtomicActor(Entity actor, String newClassName,
            ConstVariableModelAnalysis constAnalysis, Map options) {
        Expression entity = (Expression) actor;
        SootClass entityClass = PtolemyUtilities.actorClass;

        // Create a class for the entity instance.
        EntitySootClass entityInstanceClass = new EntitySootClass(entityClass,
                newClassName, Modifier.PUBLIC);
        Scene.v().addClass(entityInstanceClass);
View Full Code Here

Examples of soot.SootClass

                if (_debug) {
                    System.out.println("ComplexAttribute = " + attribute
                            + " Class = " + className);
                }

                SootClass attributeClass = Scene.v().loadClassAndSupport(
                        className);
                attributeClass.setLibraryClass();

                String newClassName = ModelTransformer.getInstanceClassName(
                        attribute, _options);

                // Create a new class for the attribute.
                SootClass newClass = SootUtilities.copyClass(attributeClass,
                        newClassName);

                // Make sure that we generate code for the new class.
                newClass.setApplicationClass();

                // Associate the new class with the attribute.
                ModelTransformer.addAttributeForClass(newClass, attribute);

                // Fold the copied class up to StringAttribute, or parameter
                SootClass superClass = newClass.getSuperclass();

                while ((superClass != PtolemyUtilities.objectClass)
                        && (superClass != PtolemyUtilities.stringAttributeClass)
                        && (superClass != PtolemyUtilities.parameterClass)) {
                    superClass.setLibraryClass();
                    SootUtilities.foldClass(newClass);
                    superClass = newClass.getSuperclass();
                }

                // Remove problematic methods for PortParameter
                if (newClass.declaresMethodByName("setContainer")) {
                    SootMethod method = newClass
                            .getMethodByName("setContainer");
                    newClass.removeMethod(method);
                }

                if (newClass.declaresMethodByName("setName")) {
                    SootMethod method = newClass.getMethodByName("setName");
                    newClass.removeMethod(method);
                }

                if (newClass.declaresMethodByName("attributeChanged")) {
                    SootMethod method = newClass
                            .getMethodByName("attributeChanged");
                    newClass.removeMethod(method);
                }

                if (newClass.declaresFieldByName("_port")) {
                    SootField field = newClass.getFieldByName("_port");
                    Port port = ((PortParameter) attribute).getPort();
                    field.addTag(new ValueTag(port));
                }

                // Add a container field to the generated class.
                // FIXME: this doesn't work for UnitSystems, e.g.,
                // since their container isn't associated with a class.
                FieldsForEntitiesTransformer._createContainerField(newClass);

                HashMap oldSignatureToFieldMap = new HashMap();

                // Loop over all the methods and replace the old class
                // wherever it appears with the copied class.
                for (Iterator classes = Scene.v().getApplicationClasses()
                        .iterator(); classes.hasNext();) {
                    SootClass theClass = (SootClass) classes.next();

                    if (theClass != newClass) {
                        _replaceObjectTypesInClassMethods(theClass, attribute,
                                attributeClass, newClass);
                    }
                }
                for (Iterator classes = Scene.v().getApplicationClasses()
                        .iterator(); classes.hasNext();) {
                    SootClass theClass = (SootClass) classes.next();

                    if (theClass != newClass) {
                        _replaceObjectTypesInClassFields(theClass, attribute,
                                attributeClass, newClass,
                                oldSignatureToFieldMap);
                    }
                }
                for (Iterator classes = Scene.v().getApplicationClasses()
                        .iterator(); classes.hasNext();) {
                    SootClass theClass = (SootClass) classes.next();

                    if (theClass != newClass) {
                        _fixFieldTypesInClassMethods(theClass, attribute,
                                attributeClass, newClass,
                                oldSignatureToFieldMap);
View Full Code Here

Examples of soot.SootClass

            // Check that the field has the right type.
            Type type = oldField.getType();

            if (type instanceof RefType) {
                SootClass refClass = ((RefType) type).getSootClass();

                if (refClass == oldClass) {
                    String oldFieldSignature = oldField.getSignature();

                    oldField.setType(RefType.v(newClass));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.