Class PtolemyUtilities


  • public class PtolemyUtilities
    extends java.lang.Object
    This class consists of ptolemy-specific static utility methods for use with Soot.
    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Stephen Neuendorffer
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • actorClass

        public static soot.SootClass actorClass
      • actorType

        public static soot.Type actorType
      • atomicActorClass

        public static soot.SootClass atomicActorClass
      • arraycopyMethod

        public static soot.SootMethod arraycopyMethod
      • arrayTokenClass

        public static soot.SootClass arrayTokenClass
      • arrayTokenConstructor

        public static soot.SootMethod arrayTokenConstructor
      • arrayTokenWithTypeConstructor

        public static soot.SootMethod arrayTokenWithTypeConstructor
      • arrayGetElementMethod

        public static soot.SootMethod arrayGetElementMethod
      • arrayValueMethod

        public static soot.SootMethod arrayValueMethod
      • arrayTypeClass

        public static soot.SootClass arrayTypeClass
      • attachTextMethod

        public static soot.SootMethod attachTextMethod
      • attributeChangedMethod

        public static soot.SootMethod attributeChangedMethod
      • attributeClass

        public static soot.SootClass attributeClass
      • attributeType

        public static soot.Type attributeType
      • baseTypeClass

        public static soot.SootClass baseTypeClass
      • booleanTokenClass

        public static soot.SootClass booleanTokenClass
      • booleanTokenConstructor

        public static soot.SootMethod booleanTokenConstructor
      • booleanValueMethod

        public static soot.SootMethod booleanValueMethod
      • booleanMatrixTokenClass

        public static soot.SootClass booleanMatrixTokenClass
      • booleanMatrixTokenConstructor

        public static soot.SootMethod booleanMatrixTokenConstructor
      • booleanMatrixTokenArrayConstructor

        public static soot.SootMethod booleanMatrixTokenArrayConstructor
      • booleanMatrixMethod

        public static soot.SootMethod booleanMatrixMethod
      • booleanTypeField

        public static soot.SootField booleanTypeField
      • booleanMatrixTypeField

        public static soot.SootField booleanMatrixTypeField
      • byteTypeField

        public static soot.SootField byteTypeField
      • classClass

        public static soot.SootClass classClass
      • complexTokenClass

        public static soot.SootClass complexTokenClass
      • complexTokenConstructor

        public static soot.SootMethod complexTokenConstructor
      • complexValueMethod

        public static soot.SootMethod complexValueMethod
      • complexMatrixTokenClass

        public static soot.SootClass complexMatrixTokenClass
      • complexMatrixTokenConstructor

        public static soot.SootMethod complexMatrixTokenConstructor
      • complexMatrixTokenArrayConstructor

        public static soot.SootMethod complexMatrixTokenArrayConstructor
      • complexMatrixMethod

        public static soot.SootMethod complexMatrixMethod
      • complexTypeField

        public static soot.SootField complexTypeField
      • complexMatrixTypeField

        public static soot.SootField complexMatrixTypeField
      • compositeActorClass

        public static soot.SootClass compositeActorClass
      • compositeEntityClass

        public static soot.SootClass compositeEntityClass
      • componentEntityClass

        public static soot.SootClass componentEntityClass
      • componentEntityType

        public static soot.RefType componentEntityType
      • componentPortClass

        public static soot.SootClass componentPortClass
      • componentPortType

        public static soot.Type componentPortType
      • connectionsChangedMethod

        public static soot.SootMethod connectionsChangedMethod
      • debuggingField

        public static soot.SootField debuggingField
      • doubleTokenClass

        public static soot.SootClass doubleTokenClass
      • doubleTokenConstructor

        public static soot.SootMethod doubleTokenConstructor
      • doubleValueMethod

        public static soot.SootMethod doubleValueMethod
      • doubleMatrixTokenClass

        public static soot.SootClass doubleMatrixTokenClass
      • doubleMatrixTokenConstructor

        public static soot.SootMethod doubleMatrixTokenConstructor
      • doubleMatrixTokenArrayConstructor

        public static soot.SootMethod doubleMatrixTokenArrayConstructor
      • doubleMatrixMethod

        public static soot.SootMethod doubleMatrixMethod
      • doubleTypeField

        public static soot.SootField doubleTypeField
      • doubleMatrixTypeField

        public static soot.SootField doubleMatrixTypeField
      • entityClass

        public static soot.SootClass entityClass
      • entityType

        public static soot.RefType entityType
      • exceptionClass

        public static soot.SootClass exceptionClass
      • executableInterface

        public static soot.SootClass executableInterface
      • executablePrefireMethod

        public static soot.SootMethod executablePrefireMethod
      • executableFireMethod

        public static soot.SootMethod executableFireMethod
      • executablePostfireMethod

        public static soot.SootMethod executablePostfireMethod
      • fixTokenClass

        public static soot.SootClass fixTokenClass
      • fixTokenConstructor

        public static soot.SootMethod fixTokenConstructor
      • fixTokenThreeArgConstructor

        public static soot.SootMethod fixTokenThreeArgConstructor
      • fixValueMethod

        public static soot.SootMethod fixValueMethod
      • fixMatrixTokenClass

        public static soot.SootClass fixMatrixTokenClass
      • fixMatrixTokenConstructor

        public static soot.SootMethod fixMatrixTokenConstructor
      • fixMatrixTokenArrayConstructor

        public static soot.SootMethod fixMatrixTokenArrayConstructor
      • fixMatrixMethod

        public static soot.SootMethod fixMatrixMethod
      • fixTypeClass

        public static soot.SootClass fixTypeClass
      • fixTypeField

        public static soot.SootField fixTypeField
      • fixMatrixTypeField

        public static soot.SootField fixMatrixTypeField
      • floatTokenClass

        public static soot.SootClass floatTokenClass
      • floatTokenConstructor

        public static soot.SootMethod floatTokenConstructor
      • floatTypeField

        public static soot.SootField floatTypeField
      • floatValueMethod

        public static soot.SootMethod floatValueMethod
      • generalTypeField

        public static soot.SootField generalTypeField
      • getClassMethod

        public static soot.SootMethod getClassMethod
      • getMethod

        public static soot.SootMethod getMethod
      • getInsideMethod

        public static soot.SootMethod getInsideMethod
      • getAttributeMethod

        public static soot.SootMethod getAttributeMethod
      • getContainerMethod

        public static soot.SootMethod getContainerMethod
      • getDirectorMethod

        public static soot.SootMethod getDirectorMethod
      • getEntityMethod

        public static soot.SootMethod getEntityMethod
      • findEffigyMethod

        public static soot.SootMethod findEffigyMethod
      • functionTokenClass

        public static soot.SootClass functionTokenClass
      • functionTokenConstructor

        public static soot.SootMethod functionTokenConstructor
      • functionTokenApplyMethod

        public static soot.SootMethod functionTokenApplyMethod
      • functionTypeClass

        public static soot.SootClass functionTypeClass
      • functionInterface

        public static soot.SootClass functionInterface
      • getExpressionMethod

        public static soot.SootMethod getExpressionMethod
      • getFullNameMethod

        public static soot.SootMethod getFullNameMethod
      • getNameMethod

        public static soot.SootMethod getNameMethod
      • getModelURIMethod

        public static soot.SootMethod getModelURIMethod
      • getPortMethod

        public static soot.SootMethod getPortMethod
      • handleModelErrorMethod

        public static soot.SootMethod handleModelErrorMethod
      • hasTokenMethod

        public static soot.SootMethod hasTokenMethod
      • initializableInterface

        public static soot.SootClass initializableInterface
      • inequalityTermClass

        public static soot.SootClass inequalityTermClass
      • explicitChangeContextClass

        public static soot.SootClass explicitChangeContextClass
      • insertLinkMethod

        public static soot.SootMethod insertLinkMethod
      • intTokenClass

        public static soot.SootClass intTokenClass
      • intTokenConstructor

        public static soot.SootMethod intTokenConstructor
      • intValueMethod

        public static soot.SootMethod intValueMethod
      • intMatrixTokenClass

        public static soot.SootClass intMatrixTokenClass
      • intMatrixTokenConstructor

        public static soot.SootMethod intMatrixTokenConstructor
      • intMatrixTokenArrayConstructor

        public static soot.SootMethod intMatrixTokenArrayConstructor
      • intMatrixMethod

        public static soot.SootMethod intMatrixMethod
      • intTypeField

        public static soot.SootField intTypeField
      • intMatrixTypeField

        public static soot.SootField intMatrixTypeField
      • invalidateResolvedTypesMethod

        public static soot.SootMethod invalidateResolvedTypesMethod
      • ioportClass

        public static soot.SootClass ioportClass
      • ioportType

        public static soot.Type ioportType
      • kernelExceptionClass

        public static soot.SootClass kernelExceptionClass
      • kernelRuntimeExceptionClass

        public static soot.SootClass kernelRuntimeExceptionClass
      • limitedFiringSourceClass

        public static soot.SootClass limitedFiringSourceClass
      • longTokenClass

        public static soot.SootClass longTokenClass
      • longTokenConstructor

        public static soot.SootMethod longTokenConstructor
      • longValueMethod

        public static soot.SootMethod longValueMethod
      • longMatrixTokenClass

        public static soot.SootClass longMatrixTokenClass
      • longMatrixTokenConstructor

        public static soot.SootMethod longMatrixTokenConstructor
      • longMatrixTokenArrayConstructor

        public static soot.SootMethod longMatrixTokenArrayConstructor
      • longMatrixMethod

        public static soot.SootMethod longMatrixMethod
      • longTypeField

        public static soot.SootField longTypeField
      • longMatrixTypeField

        public static soot.SootField longMatrixTypeField
      • managerClass

        public static soot.SootClass managerClass
      • matrixTokenClass

        public static soot.SootClass matrixTokenClass
      • matrixTokenCreateMethod

        public static soot.SootMethod matrixTokenCreateMethod
      • matrixGetElementAsTokenMethod

        public static soot.SootMethod matrixGetElementAsTokenMethod
      • matrixTypeClass

        public static soot.SootClass matrixTypeClass
      • namedObjClass

        public static soot.SootClass namedObjClass
      • nonStrictTestClass

        public static soot.SootClass nonStrictTestClass
      • objectClass

        public static soot.SootClass objectClass
      • objectConstructor

        public static soot.SootMethod objectConstructor
      • objectTypeField

        public static soot.SootField objectTypeField
      • parameterClass

        public static soot.SootClass parameterClass
      • portClass

        public static soot.SootClass portClass
      • portParameterClass

        public static soot.SootClass portParameterClass
      • portParameterGetPortMethod

        public static soot.SootMethod portParameterGetPortMethod
      • portParameterUpdateMethod

        public static soot.SootMethod portParameterUpdateMethod
      • portSetTypeMethod

        public static soot.SootMethod portSetTypeMethod
      • ptParserClass

        public static soot.SootClass ptParserClass
      • relationClass

        public static soot.SootClass relationClass
      • recordTokenClass

        public static soot.SootClass recordTokenClass
      • recordTokenConstructor

        public static soot.SootMethod recordTokenConstructor
      • recordGetMethod

        public static soot.SootMethod recordGetMethod
      • recordTypeClass

        public static soot.SootClass recordTypeClass
      • relationType

        public static soot.Type relationType
      • runtimeExceptionClass

        public static soot.SootClass runtimeExceptionClass
      • runtimeExceptionConstructor

        public static soot.SootMethod runtimeExceptionConstructor
      • runtimeExceptionStringConstructor

        public static soot.SootMethod runtimeExceptionStringConstructor
      • scalarTokenClass

        public static soot.SootClass scalarTokenClass
      • sendMethod

        public static soot.SootMethod sendMethod
      • sendInsideMethod

        public static soot.SootMethod sendInsideMethod
      • setExpressionMethod

        public static soot.SootMethod setExpressionMethod
      • setInputMethod

        public static soot.SootMethod setInputMethod
      • setOutputMethod

        public static soot.SootMethod setOutputMethod
      • setMultiportMethod

        public static soot.SootMethod setMultiportMethod
      • setNameMethod

        public static soot.SootMethod setNameMethod
      • settableClass

        public static soot.SootClass settableClass
      • settableType

        public static soot.Type settableType
      • setVisibilityMethod

        public static soot.SootMethod setVisibilityMethod
      • stopRequestedField

        public static soot.SootField stopRequestedField
      • stringAttributeClass

        public static soot.SootClass stringAttributeClass
      • stringClass

        public static soot.SootClass stringClass
      • shortTypeField

        public static soot.SootField shortTypeField
      • stringTypeField

        public static soot.SootField stringTypeField
      • shortTokenClass

        public static soot.SootClass shortTokenClass
      • shortTokenConstructor

        public static soot.SootMethod shortTokenConstructor
      • shortValueMethod

        public static soot.SootMethod shortValueMethod
      • stringTokenClass

        public static soot.SootClass stringTokenClass
      • stringTokenConstructor

        public static soot.SootMethod stringTokenConstructor
      • stringValueMethod

        public static soot.SootMethod stringValueMethod
      • systemClass

        public static soot.SootClass systemClass
      • tokenClass

        public static soot.SootClass tokenClass
      • tokenGetTypeMethod

        public static soot.SootMethod tokenGetTypeMethod
      • tokenAddMethod

        public static soot.SootMethod tokenAddMethod
      • tokenSubtractMethod

        public static soot.SootMethod tokenSubtractMethod
      • tokenModuloMethod

        public static soot.SootMethod tokenModuloMethod
      • tokenMultiplyMethod

        public static soot.SootMethod tokenMultiplyMethod
      • tokenDivideMethod

        public static soot.SootMethod tokenDivideMethod
      • tokenEqualsMethod

        public static soot.SootMethod tokenEqualsMethod
      • tokenIsLessThanMethod

        public static soot.SootMethod tokenIsLessThanMethod
      • tokenNotMethod

        public static soot.SootMethod tokenNotMethod
      • tokenBitwiseAndMethod

        public static soot.SootMethod tokenBitwiseAndMethod
      • tokenBitwiseOrMethod

        public static soot.SootMethod tokenBitwiseOrMethod
      • tokenBitwiseXorMethod

        public static soot.SootMethod tokenBitwiseXorMethod
      • tokenBitwiseNotMethod

        public static soot.SootMethod tokenBitwiseNotMethod
      • tokenLeftShiftMethod

        public static soot.SootMethod tokenLeftShiftMethod
      • tokenRightShiftMethod

        public static soot.SootMethod tokenRightShiftMethod
      • tokenLogicalRightShiftMethod

        public static soot.SootMethod tokenLogicalRightShiftMethod
      • tokenIntValueMethod

        public static soot.SootMethod tokenIntValueMethod
      • tokenZeroMethod

        public static soot.SootMethod tokenZeroMethod
      • tokenPowMethod

        public static soot.SootMethod tokenPowMethod
      • tokenType

        public static soot.RefType tokenType
      • toplevelMethod

        public static soot.SootMethod toplevelMethod
      • toStringMethod

        public static soot.SootMethod toStringMethod
      • typeClass

        public static soot.SootClass typeClass
      • typeConvertMethod

        public static soot.SootMethod typeConvertMethod
      • typeLatticeClass

        public static soot.SootClass typeLatticeClass
      • unknownTypeField

        public static soot.SootField unknownTypeField
      • unsignedByteTokenClass

        public static soot.SootClass unsignedByteTokenClass
      • unsignedByteTokenConstructor

        public static soot.SootMethod unsignedByteTokenConstructor
      • unsignedByteValueMethod

        public static soot.SootMethod unsignedByteValueMethod
      • validateMethod

        public static soot.SootMethod validateMethod
      • variableClass

        public static soot.SootClass variableClass
      • variableConstructorWithoutToken

        public static soot.SootMethod variableConstructorWithoutToken
      • variableConstructorWithToken

        public static soot.SootMethod variableConstructorWithToken
      • variableGetTokenMethod

        public static soot.SootMethod variableGetTokenMethod
      • variableSetTokenMethod

        public static soot.SootMethod variableSetTokenMethod
    • Constructor Detail

      • PtolemyUtilities

        public PtolemyUtilities()
    • Method Detail

      • buildConstantTokenLocal

        public static soot.Local buildConstantTokenLocal​(soot.jimple.JimpleBody body,
                                                         soot.Unit insertPoint,
                                                         Token token,
                                                         java.lang.String localName)
        Create a new Local variable in the given body with the given name. Insert statements into the given body before the given unit to initialize the value of that local to a token that has the same value as the given token.
        Returns:
        The new local.
      • addTokenLocal

        public static soot.Local addTokenLocal​(soot.Body body,
                                               java.lang.String localName,
                                               soot.SootClass tokenClass,
                                               soot.SootMethod tokenConstructor,
                                               soot.Value constructorArg)
      • addTokenLocalBefore

        public static soot.Local addTokenLocalBefore​(soot.Body body,
                                                     soot.Unit insertPoint,
                                                     java.lang.String localName,
                                                     soot.SootClass tokenClass,
                                                     soot.SootMethod tokenConstructor,
                                                     soot.Value constructorArg)
      • addTokenLocalBefore

        public static soot.Local addTokenLocalBefore​(soot.Body body,
                                                     soot.Unit insertPoint,
                                                     java.lang.String localName,
                                                     soot.SootClass tokenClass,
                                                     soot.SootMethod tokenConstructor,
                                                     java.util.List constructorArgs)
      • buildConstantTypeLocal

        public static soot.Local buildConstantTypeLocal​(soot.Body body,
                                                        java.lang.Object insertPoint,
                                                        Type type)
        Insert a local into the given body and code before the given insertion point to initialize that local to an instance that is equal to the given type.
        Returns:
        The created local.
      • callAttributeChanged

        public static void callAttributeChanged​(soot.Local base,
                                                soot.Local attributeLocal,
                                                soot.SootClass theClass,
                                                soot.SootMethod method,
                                                soot.jimple.JimpleBody body,
                                                soot.jimple.Stmt insertPoint)
        Insert code into the given body before the given insertion point to call the attribute changed method on the object stored in the given local.
        Parameters:
        base - A local that is assumed to have an attribute type.
      • createNamedObjAndLocal

        public static soot.Local createNamedObjAndLocal​(soot.Body body,
                                                        java.lang.String className,
                                                        soot.Local container,
                                                        java.lang.String name)
        In the given body, create a new local with the given name. The local will refer to an object of type className. Add instructions to the end of the chain of the body to create and initialize a new named object with the given container and name. Assign the value of the local to the created instance.
        Returns:
        The local that was created.
      • createSuperConstructor

        public static soot.SootMethod createSuperConstructor​(soot.SootClass theClass,
                                                             soot.SootMethod superConstructor)
        Create a constructor in theClass that has the same signature as the given method. Add instructions to the body of the constructor that call the given method with the same arguments.
      • getBaseTokenType

        public static soot.RefType getBaseTokenType​(soot.Type type)
        If the given type is a reference type to a class that derives from ptolemy.data.Token, or array whose element type derives from ptolemy.data.Token, then return that token type. Otherwise return null.
      • getBaseTokenTypeType

        public static soot.RefType getBaseTokenTypeType​(soot.Type type)
        If the given type is a reference type to a class that derives from ptolemy.data.Type, or array whose element type derives from ptolemy.data.Type, then return that token type. Otherwise return null.
      • getTypeDepth

        public static int getTypeDepth​(Type type)
        Return the depth of the given type. Most simple types have depth one, while structured types have depth greater than one.
      • getSootTypeForTokenType

        public static soot.RefType getSootTypeForTokenType​(Type type)
        Given a ptolemy token type, return the soot type that can reference tokens of the ptolemy type.
      • getTokenTypeForSootType

        public static Type getTokenTypeForSootType​(soot.RefType type)
        Given a soot type that references a token class, return the ptolemy token type associated with the token class. If the type is an array token, then the returned type will have an indeterminate element type.
      • getTokenTypeTypeForSootType

        public static Type getTokenTypeTypeForSootType​(soot.RefType type)
        Given a soot type that references a type class, return the ptolemy token type associated with the type class. If the type is an array token, then the returned type will have an indeterminate element type.
      • getTypeValue

        public static Type getTypeValue​(soot.SootMethod method,
                                        soot.Local local,
                                        soot.Unit location,
                                        soot.toolkits.scalar.LocalDefs localDefs,
                                        soot.toolkits.scalar.LocalUses localUses)
        Attempt to determine the constant value of the given local, which is assumed to have a variable type. Walk backwards through all the possible places that the local may have been defined and try to symbolically evaluate the value of the variable. If the value can be determined, then return it, otherwise throw an exception
      • inlineTypeableMethods

        public static boolean inlineTypeableMethods​(soot.jimple.JimpleBody body,
                                                    soot.Unit unit,
                                                    soot.ValueBox box,
                                                    soot.jimple.InstanceInvokeExpr expr,
                                                    Typeable typeable)
        Inline the given invocation expression, given knowledge that the method was invoked on the given Typeable object, and that the typeable object has a final resolved type. The getType method will be replace with code that returns the resolved type as a constant, methods that add type constraints are removed, and other methods that return a value are changed to throw exceptions.
        Parameters:
        body - The body in which the invoke occurred.
        unit - The unit in which the invoke occurred.
        box - The value box containing the invoke expression.
        typeable - A reference to an object that has the same resolve type as the typeable object that the invoke would have occurred on, has the code actually been executed.
      • isExactTokenType

        public static boolean isExactTokenType​(Type type)
        Return true if the given type is an exact token type.
      • isConcreteTokenType

        public static boolean isConcreteTokenType​(soot.Type type)
        Return true if the given type references a concrete ptolemy token type. In other words It is either a direct reference to a token, or an array of tokens. This method only returns true if the token is an instantiable token.
      • isArrayTokenType

        public static boolean isArrayTokenType​(soot.Type type)
        Return true if the given type references a ptolemy token type. In other words It is either a direct reference to a token, or an array of tokens.
      • isTokenType

        public static boolean isTokenType​(soot.Type type)
        Return true if the given type references a ptolemy token type. In other words It is either a direct reference to a Token, or an array of Tokens.
      • isTypeType

        public static boolean isTypeType​(soot.Type type)
        Return true if the given type references a ptolemy token type type. In other words It is either a direct reference to a Type, or an array of Types.
      • loadSootReferences

        public static void loadSootReferences()
        Initialize the fields of this class to point to classes in the current soot tree.