Class UnitAttribute

    • Method Detail

      • addValueListener

        public void addValueListener​(ValueListener listener)
        Add a listener to be notified when the value of this attribute changes. If the listener is already on the list of listeners, then do nothing.
        Parameters:
        listener - The listener to add.
        See Also:
        Settable.removeValueListener(ValueListener)
      • exportMoML

        public void exportMoML​(java.io.Writer output,
                               int depth,
                               java.lang.String name)
                        throws java.io.IOException
        Write a MoML description of the UnitsAttribute. Nothing is written if the value is null or "".
        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.exportMoML(Writer, int, String)
      • getExpression

        public java.lang.String getExpression()
        Get the descriptive form of this attribute.
        Returns:
        a String that represents the descriptive form.
        See Also:
        Settable.getExpression()
      • getUnitConstraints

        public UnitConstraints getUnitConstraints()
        Get the UnitConstraints.
        Returns:
        The UnitConstraints.
      • getUnitExpr

        public UnitExpr getUnitExpr()
        Get the Unit Expression.
        Returns:
        The UnitExpr.
      • getVisibility

        public Settable.Visibility getVisibility()
        Get the visibility of this attribute, as set by setVisibility(). The visibility is set by default to NONE.
        Returns:
        The visibility of this attribute.
        See Also:
        Settable.getVisibility()
      • removeValueListener

        public void removeValueListener​(ValueListener listener)
        Remove a listener from the list of listeners that is notified when the value of this attribute changes. If no such listener exists, do nothing.
        Parameters:
        listener - The listener to remove.
        See Also:
        Settable.addValueListener(ValueListener)
      • setUnitConstraints

        public void setUnitConstraints​(UnitConstraints constraints)
        Set the UnitConstraints.
        Parameters:
        constraints - The UnitConstraints.
      • setUnitExpr

        public void setUnitExpr​(UnitExpr expr)
        Set the Unit Expression.
        Parameters:
        expr - A UnitExpr.
      • validate

        public java.util.Collection validate()
                                      throws IllegalActionException
        Description copied from interface: Settable
        Check the validity of the expression set in setExpression(). Implementations of this method should notify the container by calling attributeChanged(), unless the container has already been notified in setExpression(). They should also notify any registered value listeners if they have not already been notified. If any other instances of Settable are validated as a side effect, then an implementation should return a Collection containing those instances. This can be used by the caller to avoid validating those again. The list may contain this instance of Settable.
        Returns:
        A collection of settables that are also validated as a side effect, or null if there are none.
        Throws:
        IllegalActionException - If the expression is not valid, or its value is not acceptable to the container or the listeners.
      • _propagateValue

        protected void _propagateValue​(NamedObj destination)
                                throws IllegalActionException
        Propagate the value of this object to the specified object. The specified object is required to be an instance of the same class as this one, or a ClassCastException will be thrown.
        Overrides:
        _propagateValue in class NamedObj
        Parameters:
        destination - Object to which to propagate the value.
        Throws:
        IllegalActionException - If the value cannot be propagated.