ptolemy.actor.parameters
Class ParameterPort

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

public class ParameterPort
extends ptolemy.actor.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,v 1.25 2004/04/13 05:12:09 cxh Exp $
Author:
Edward A. Lee
See Also:
PortParameter, Serialized Form
Accepted Rating:
Yellow (neuendor)
Proposed Rating:
Green (eal)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.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
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, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
ParameterPort(ptolemy.kernel.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(ptolemy.kernel.util.Workspace workspace)
          Clone the port.
 PortParameter getParameter()
          Get the associated parameter.
 void setContainer(ptolemy.kernel.Entity entity)
          Set the container of this port.
 void setName(java.lang.String name)
          Set the name, and propagate the name change to the associated port.
 
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
 
Methods inherited from class ptolemy.actor.IOPort
_checkLiberalLink, _exportMoMLContents, _getInsideWidth, _newInsideReceiver, _newReceiver, broadcastClear, createReceivers, deepConnectedInPortList, deepConnectedInPorts, deepConnectedOutPortList, deepConnectedOutPorts, deepGetReceivers, get, get, getCurrentTime, getInside, getInsideReceivers, getReceivers, getReceivers, getReceivers, getRemoteReceivers, getRemoteReceivers, getWidth, getWidthInside, hasRoom, hasRoomInside, hasToken, hasToken, hasTokenInside, insertLink, insideSinkPortList, insideSourcePortList, isInput, isKnown, isKnown, isKnownInside, isMultiport, isOutput, liberalLink, link, numberOfSinks, numberOfSources, sendClear, sendClearInside, setInput, setMultiport, setOutput, 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, isInsideLinked, isOpaque, numInsideLinks
 
Methods inherited from class ptolemy.kernel.Port
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isLinked, linkedRelationList, linkedRelations, numLinks
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, 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(ptolemy.kernel.ComponentEntity container,
                     java.lang.String name)
              throws ptolemy.kernel.util.IllegalActionException,
                     ptolemy.kernel.util.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:
ptolemy.kernel.util.IllegalActionException - If the port is not of an acceptable class for the container, or if the container does not implement the Actor interface.
ptolemy.kernel.util.NameDuplicationException - If the name coincides with a port already in the container.
Method Detail

clone

public java.lang.Object clone(ptolemy.kernel.util.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.

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(ptolemy.kernel.Entity entity)
                  throws ptolemy.kernel.util.IllegalActionException,
                         ptolemy.kernel.util.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.

Parameters:
entity - The new container.
Throws:
ptolemy.kernel.util.IllegalActionException - If the superclass throws it.
ptolemy.kernel.util.NameDuplicationException - If the superclass throws it.
See Also:
PortParameter

getParameter

public PortParameter getParameter()
Get the associated parameter.

Returns:
The associated parameter.

setName

public void setName(java.lang.String name)
             throws ptolemy.kernel.util.IllegalActionException,
                    ptolemy.kernel.util.NameDuplicationException
Set the name, and propagate the name change to the associated port. 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.

Parameters:
name - The new name.
Throws:
ptolemy.kernel.util.IllegalActionException - If the name contains a period.
ptolemy.kernel.util.NameDuplicationException - If the container already contains an attribute with the proposed name.

_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.