Class GeneratorAttribute

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, ChangeListener, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Singleton
    Direct Known Subclasses:
    GeneratorTableauAttribute

    public class GeneratorAttribute
    extends SingletonAttribute
    implements ChangeListener
    This is an attribute that stores the configuration of a code generator.

    The initial default parameters, their values and their documentation are read in from a MoML file specified by the initialParametersURL. Having the parameters defined in a MoML file allows us to easily add and modify parameters without lots of bookkeeping.

    To view the initial default parameters, either call toString(), or run:

     java -classpath $PTII ptolemy.copernicus.kernel.Copernicus -help
     
    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee, Christopher Hylands
    Pt.AcceptedRating:
    Red (johnr)
    Pt.ProposedRating:
    Red (eal)
    • Field Detail

      • initialParametersURL

        public StringParameter initialParametersURL
        MoML file that contains other parameters. The default value is the string "ptolemy/copernicus/kernel/Generator.xml".
    • Constructor Detail

      • GeneratorAttribute

        public GeneratorAttribute​(NamedObj container,
                                  java.lang.String name)
                           throws IllegalActionException,
                                  NameDuplicationException
        Construct an attribute with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
        Parameters:
        container - The container.
        name - The name of this attribute.
        Throws:
        IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.
        NameDuplicationException - If the name coincides with an attribute already in the container.
    • Method Detail

      • changeExecuted

        public void changeExecuted​(ChangeRequest change)
        Description copied from interface: ChangeListener
        React to a change request has been successfully executed. This method is called after a change request has been executed successfully.
        Specified by:
        changeExecuted in interface ChangeListener
        Parameters:
        change - The change that has been executed, or null if the change was not done via a ChangeRequest.
      • changeFailed

        public void changeFailed​(ChangeRequest change,
                                 java.lang.Exception exception)
        Description copied from interface: ChangeListener
        React to a change request has resulted in an exception. This method is called after a change request was executed, but during the execution an exception was thrown.
        Specified by:
        changeFailed in interface ChangeListener
        Parameters:
        change - The change that was attempted or null if the change was not done via a ChangeRequest.
        exception - The exception that resulted.
      • getParameter

        public java.lang.String getParameter​(java.lang.String name)
                                      throws IllegalActionException
        Get the string for the argument with the given name from this GeneratorAttribute.
        Throws:
        IllegalActionException - If no Settable object with the given name exists in this GeneratorAttribute.
      • lookupClassAsResource

        @Deprecated
        public static java.lang.String lookupClassAsResource​(java.lang.String necessaryClass)
        Deprecated.
        Call ptolemy.util.ClassUtilities.lookupClassAsResource() instead;
        Given a dot separated classname, return the jar file or directory where the class can be found.
        Parameters:
        necessaryClass - The dot separated class name, for example "ptolemy.kernel.util.NamedObj"
        Returns:
        If the class can be found as a resource, return the directory or jar file where the necessary class can be found. otherwise, return null.
      • setParameter

        public void setParameter​(java.lang.String name,
                                 java.lang.String value)
                          throws IllegalActionException
        Set the string for the argument with the given name from this GeneratorAttribute to be the given value.
        Throws:
        IllegalActionException - If no Settable object with the given name exists in this GeneratorAttribute.
      • toString

        public java.lang.String toString()
        Return a String representation of this object.
        Overrides:
        toString in class NamedObj
        Returns:
        The class name and the full name.
      • updateModelAttributes

        public void updateModelAttributes​(java.lang.String modelPathOrURL)
                                   throws IllegalActionException
        Update the modelPath, modelName and iterations parameters in the GeneratorAttribute. This method parses the model and updates all GeneratorAttribute parameters that are determined by the model itself.
        Parameters:
        modelPathOrURL - The file pathname or URL to the model.
        Throws:
        IllegalActionException