ptolemy.actor.parameters
Class ParameterPort

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.Port
          extended by ptolemy.kernel.ComponentPort
              extended by ptolemy.actor.IOPort
                  extended by ptolemy.actor.TypedIOPort
                      extended by ptolemy.actor.parameters.ParameterPort
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class ParameterPort
extends TypedIOPort

A specialized port for use with PortParameter. This port is created by an instance of PortParameter and provides values to a parameter. Data should not be read directly from this port. Instead, the update method of the corresponding PortParameter should be invoked. This port is only useful if the container is opaque, however, this is not checked.

Since:
Ptolemy II 3.0
Version:
$Id: ParameterPort.java 57763 2010-05-04 01:08:40Z cxh $
Author:
Edward A. Lee
See Also:
PortParameter, Serialized Form
Accepted Rating:
Yellow (neuendor)
Proposed Rating:
Green (eal)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected  PortParameter _parameter
          The associated parameter.
protected  boolean _settingName
          Indicator that we are in the midst of setting the name.
 
Fields inherited from class ptolemy.actor.TypedIOPort
TYPE
 
Fields inherited from class ptolemy.actor.IOPort
_hasPortEventListeners, _portEventListeners, CONFIGURATION, RECEIVERS, REMOTERECEIVERS
 
Fields inherited from class ptolemy.kernel.Port
_insideLinks, _relationsList
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
ParameterPort(ComponentEntity container, java.lang.String name)
          Construct a new input port in the specified container with the specified name.
 
Method Summary
protected  void _setTypeConstraints()
          Set the type constraints between the protected member _parameter and this port.
 java.lang.Object clone(Workspace workspace)
          Clone the port.
 PortParameter getParameter()
          Get the associated parameter.
 void setContainer(Entity entity)
          Set the container of this port.
 void setDisplayName(java.lang.String name)
          Set the display name, and propagate the name change to the associated parameter.
 void setName(java.lang.String name)
          Set the name, and propagate the name change to the associated parameter.
 
Methods inherited from class ptolemy.actor.TypedIOPort
_checkContainer, _checkLiberalLink, _checkLink, _checkType, _description, addTypeListener, attributeChanged, broadcast, broadcast, convert, getType, getTypeTerm, isTypeAcceptable, removeTypeListener, send, send, sendInside, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.IOPort
_checkLiberalLink, _exportMoMLContents, _getInsideWidth, _getOutsideWidth, _getReceiversLinkedToGroup, _newInsideReceiver, _newReceiver, _notifyPortEventListeners, _removeReceivers, addIOPortEventListener, broadcastClear, checkWidthConstraints, createReceivers, deepConnectedInPortList, deepConnectedInPorts, deepConnectedOutPortList, deepConnectedOutPorts, deepGetReceivers, get, get, getChannelForReceiver, getCurrentTime, getDefaultWidth, getInside, getInsideReceivers, getModelTime, getReceivers, getReceivers, getReceivers, getRelationIndex, getRemoteReceivers, getRemoteReceivers, getWidth, getWidthFromConstraints, getWidthInside, hasRoom, hasRoomInside, hasToken, hasToken, hasTokenInside, hasWidthConstraints, insertLink, insideSinkPortList, insideSourcePortList, isInput, isInsideConnected, isKnown, isKnown, isKnownInside, isMultiport, isOutput, isOutsideConnected, liberalLink, link, numberOfSinks, numberOfSources, removeIOPortEventListener, sendClear, sendClearInside, setDefaultWidth, setInput, setMultiport, setOutput, setWidthEquals, setWidthEquals, sinkPortList, sourcePortList, transferInputs, transferOutputs, unlink, unlink, unlinkAll, unlinkAllInside, unlinkInside, unlinkInside
 
Methods inherited from class ptolemy.kernel.ComponentPort
_deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _isInsideLinkable, deepConnectedPortList, deepConnectedPorts, deepInsidePortList, deepInsidePorts, insertInsideLink, insidePortList, insidePorts, insideRelationList, insideRelations, isDeeplyConnected, isInsideGroupLinked, isInsideLinked, isOpaque, numInsideLinks
 
Methods inherited from class ptolemy.kernel.Port
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isGroupLinked, isLinked, linkedRelationList, linkedRelations, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, numLinks
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, 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
 

Field Detail

_settingName

protected boolean _settingName
Indicator that we are in the midst of setting the name.


_parameter

protected PortParameter _parameter
The associated parameter.

Constructor Detail

ParameterPort

public ParameterPort(ComponentEntity container,
                     java.lang.String name)
              throws IllegalActionException,
                     NameDuplicationException
Construct a new input port in the specified container with the specified name. The specified container must implement the Actor interface, or an exception will be thrown.

Parameters:
container - The container.
name - The name of the port.
Throws:
IllegalActionException - If the port is not of an acceptable class for the container, or if the container does not implement the Actor interface.
NameDuplicationException - If the name coincides with a port already in the container.
Method Detail

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Clone the port. This overrides the base class to remove the current association with a parameter. It is assumed that the parameter will also be cloned, and when the containers are set of this port and that parameter, whichever one is set second will result in re-establishment of the association.

Overrides:
clone in class TypedIOPort
Parameters:
workspace - The workspace in which to place the cloned port.
Returns:
The cloned port.
Throws:
java.lang.CloneNotSupportedException - Not thrown in this base class.
See Also:
Object.clone()

setContainer

public void setContainer(Entity entity)
                  throws IllegalActionException,
                         NameDuplicationException
Set the container of this port. If the container is different from what it was before and there is an associated parameter, then break the association. If the new container has a parameter with the same name as this port, then establish a new association. That parameter must be an instance of PortParameter, or no association is created.

Overrides:
setContainer in class IOPort
Parameters:
entity - The new container.
Throws:
IllegalActionException - If the superclass throws it.
NameDuplicationException - If the superclass throws it.
See Also:
PortParameter

getParameter

public PortParameter getParameter()
Get the associated parameter.

Returns:
The associated parameter.

setDisplayName

public void setDisplayName(java.lang.String name)
Set the display name, and propagate the name change to the associated parameter. Increment the version of the workspace. This method is write-synchronized on the workspace.

Overrides:
setDisplayName in class NamedObj
Parameters:
name - The new display name.
Throws:
IllegalActionException - If the name contains a period.
NameDuplicationException - If the container already contains an attribute with the proposed name.
See Also:
NamedObj.getDisplayName()

setName

public void setName(java.lang.String name)
             throws IllegalActionException,
                    NameDuplicationException
Set the name, and propagate the name change to the associated parameter. If a null argument is given, then the name is set to an empty string. Increment the version of the workspace. This method is write-synchronized on the workspace.

Specified by:
setName in interface Nameable
Overrides:
setName in class Port
Parameters:
name - The new name.
Throws:
IllegalActionException - If the name contains a period.
NameDuplicationException - If the container already contains an attribute with the proposed name.
See Also:
NamedObj.getName(), NamedObj.getName(NamedObj)

_setTypeConstraints

protected void _setTypeConstraints()
Set the type constraints between the protected member _parameter and this port. This is a protected method so that subclasses can define different type constraints. It is assured that when this is called, _parameter is non-null. However, use caution, since this method may be called during construction of this port, and hence the port may not be fully constructed.