ptolemy.actor.gt
Class ParameterAttribute

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.gt.TransformationAttribute
              extended by ptolemy.actor.gt.ParameterAttribute
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable
Direct Known Subclasses:
Constraint, DefaultDirectoryAttribute, DefaultModelAttribute

public abstract class ParameterAttribute
extends TransformationAttribute
implements Settable

Since:
Ptolemy II 6.1
Version:
$Id: ParameterAttribute.java,v 1.6.4.1 2008/03/25 22:12:10 cxh Exp $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Red (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
 
Field Summary
 Parameter parameter
           
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
 
Constructor Summary
ParameterAttribute(NamedObj container, java.lang.String name)
           
ParameterAttribute(Workspace workspace)
           
 
Method Summary
protected abstract  void _initParameter()
           
 void addValueListener(ValueListener listener)
          Add a listener to be notified when the value of this settable object changes.
 java.lang.String getDefaultExpression()
          Return the default value of this attribute, if there is one, or null if there is none.
 java.lang.String getExpression()
          Get the expression of the attribute that has been set by setExpression(), or null if there is none.
 java.lang.String getValueAsString()
          Get the value of the attribute, which is the evaluated expression.
 Settable.Visibility getVisibility()
          Get the visibility of this Settable, as set by setVisibility().
 void removeValueListener(ValueListener listener)
          Remove a listener from the list of listeners that are notified when the value of this variable changes.
 void setExpression(java.lang.String expression)
          Set the value of the attribute by giving some expression.
 void setVisibility(Settable.Visibility visibility)
          Set the visibility of this Settable.
 java.util.Collection<?> validate()
          Check the validity of the expression set in setExpression().
 
Methods inherited from class ptolemy.actor.gt.TransformationAttribute
_checkContainerClass, _checkUniqueness, _setIconDescription
 
Methods inherited from class ptolemy.kernel.util.Attribute
_getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName, setName
 

Field Detail

parameter

public Parameter parameter
Constructor Detail

ParameterAttribute

public ParameterAttribute(NamedObj container,
                          java.lang.String name)
                   throws NameDuplicationException,
                          IllegalActionException
Throws:
NameDuplicationException
IllegalActionException

ParameterAttribute

public ParameterAttribute(Workspace workspace)
Method Detail

addValueListener

public void addValueListener(ValueListener listener)
Description copied from interface: Settable
Add a listener to be notified when the value of this settable object changes. An implementation of this method should ignore the call if the specified listener is already on the list of listeners. In other words, it should not be possible for the same listener to be notified twice of a value update.

Specified by:
addValueListener in interface Settable
Parameters:
listener - The listener to add.
See Also:
Settable.removeValueListener(ValueListener)

getDefaultExpression

public java.lang.String getDefaultExpression()
Description copied from interface: Settable
Return the default value of this attribute, if there is one, or null if there is none.

Specified by:
getDefaultExpression in interface Settable
Returns:
The default value of this attribute, or null if there is none.

getExpression

public java.lang.String getExpression()
Description copied from interface: Settable
Get the expression of the attribute that has been set by setExpression(), or null if there is none.

Specified by:
getExpression in interface Settable
Returns:
The expression.
See Also:
Settable.setExpression(String)

getValueAsString

public java.lang.String getValueAsString()
Description copied from interface: Settable
Get the value of the attribute, which is the evaluated expression.

Specified by:
getValueAsString in interface Settable
Returns:
The value.
See Also:
Settable.getExpression()

getVisibility

public Settable.Visibility getVisibility()
Description copied from interface: Settable
Get the visibility of this Settable, as set by setVisibility(). If setVisibility() has not been called, then implementations of this interface should return some default, not null, indicating user-level visibility. The returned value is one of the static instances of the Visibility inner class.

Specified by:
getVisibility in interface Settable
Returns:
The visibility of this Settable.
See Also:
Settable.setVisibility(Settable.Visibility)

removeValueListener

public void removeValueListener(ValueListener listener)
Description copied from interface: Settable
Remove a listener from the list of listeners that are notified when the value of this variable changes. If no such listener exists, do nothing.

Specified by:
removeValueListener in interface Settable
Parameters:
listener - The listener to remove.
See Also:
Settable.addValueListener(ValueListener)

setExpression

public void setExpression(java.lang.String expression)
                   throws IllegalActionException
Description copied from interface: Settable
Set the value of the attribute by giving some expression. In some implementations, the listeners and the container will be notified immediately. However, some implementations may defer notification until validate() is called.

Specified by:
setExpression in interface Settable
Parameters:
expression - The value of the attribute.
Throws:
IllegalActionException - If the expression is invalid.
See Also:
Settable.getExpression()

setVisibility

public void setVisibility(Settable.Visibility visibility)
Description copied from interface: Settable
Set the visibility of this Settable. The argument should be one of the static public instances of the inner class Visibility. This is enforced by making it impossible to construct instances of this inner class outside this interface definition. If this method is not called, then implementations of this interface should return some default, not null.

Specified by:
setVisibility in interface Settable
Parameters:
visibility - The visibility of this Settable.
See Also:
Settable.getVisibility()

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.

Specified by:
validate in interface 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.

_initParameter

protected abstract void _initParameter()
                                throws IllegalActionException,
                                       NameDuplicationException
Throws:
IllegalActionException
NameDuplicationException