Class Parameter

    • Constructor Detail

      • Parameter

        public Parameter()
        Construct a parameter in the default workspace with an empty string as its name. The parameter is added to the list of objects in the workspace. Increment the version number of the workspace.
      • Parameter

        public Parameter​(Workspace workspace)
        Construct a parameter in the specified workspace with an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. The object is added to the list of objects in the workspace. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the parameter.
      • Parameter

        public Parameter​(NamedObj container,
                         java.lang.String name)
                  throws IllegalActionException,
                         NameDuplicationException
        Construct a parameter with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This parameter 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. The object is not added to the list of objects in the workspace unless the container is null. Increment the version of the workspace.
        Parameters:
        container - The container.
        name - The name of the parameter.
        Throws:
        IllegalActionException - If the parameter is not of an acceptable class for the container.
        NameDuplicationException - If the name coincides with a parameter already in the container.
      • Parameter

        public Parameter​(NamedObj container,
                         java.lang.String name,
                         Token token)
                  throws IllegalActionException,
                         NameDuplicationException
        Construct a Parameter with the given container, name, and Token. The container argument must not be null, or a NullPointerException will be thrown. This parameter 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. The object is not added to the list of objects in the workspace unless the container is null. Increment the version of the workspace. If the name argument is null, then the name is set to the empty string.
        Parameters:
        container - The container.
        name - The name.
        token - The Token contained by this Parameter.
        Throws:
        IllegalActionException - If the parameter is not of an acceptable class for the container.
        NameDuplicationException - If the name coincides with an parameter already in the container.
    • Method Detail

      • addChoice

        public void addChoice​(java.lang.String choice)
        Add a choice.
        Parameters:
        choice - A choice to offer to the user.
        See Also:
        removeChoice(String)
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace.
        Overrides:
        clone in class Variable
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        Object.clone()
      • exportMoML

        public void exportMoML​(java.io.Writer output,
                               int depth,
                               java.lang.String name)
                        throws java.io.IOException
        Write a MoML description of this object, unless this object is not persistent. MoML is an XML modeling markup language. In this class, the object is identified by the "property" element, with "name" and "class" (XML) attributes. The body of the element, between the "<property>" and "</property>", is written using the _exportMoMLContents() protected method, so that derived classes can override that method alone to alter only how the contents of this object are described. The text that is written is indented according to the specified depth, with each line (including the last one) terminated with a newline.
        Specified by:
        exportMoML in interface MoMLExportable
        Overrides:
        exportMoML in class NamedObj
        Parameters:
        output - The output stream to write to.
        depth - The depth in the hierarchy, to determine indenting.
        name - The name to use instead of the current name.
        Throws:
        java.io.IOException - If an I/O error occurs.
        See Also:
        NamedObj.isPersistent()
      • getChoices

        public java.lang.String[] getChoices()
        Get choices.
        Returns:
        An array of choices, or null if there are none.
        See Also:
        addChoice(String)
      • removeAllChoices

        public void removeAllChoices()
        Remove all the choices.
        See Also:
        removeChoice(String)
      • removeChoice

        public void removeChoice​(java.lang.String choice)
        Remove a choice.
        Parameters:
        choice - A choice to remove from the list offered to the user.
        See Also:
        addChoice(String), removeAllChoices()