ptolemy.domains.dde.kernel
Class DDEIOPort

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.domains.dde.kernel.DDEIOPort
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class DDEIOPort
extends TypedIOPort

A DDEIOPort is a timed input/output port used in the DDE domain. DDEIOPorts are used to send tokens between actors, and in so doing, associate time with the tokens as they are placed in DDEReceivers.

DDEIOPorts are not necessary to facilitate communication between actors executing in a DDE model; standard TypedIOPorts are sufficient for most communication. DDEIOPorts become useful when the time stamp to be associated with an outgoing token is greater than the current time of the sending actor.

The designers of models that incorporate DDEIOPorts should be careful to make sure that output time stamp ordering information is correct. Since the output time stamp of a token being sent through a DDEIOPort can be greater then the sending actor's current time, it is possible on a subsequent token production to create an outgoing token with a time stamp that is greater than the current time but less then the previously produced time stamp. In such cases, an IllegalArgumentException will be thrown.

Since:
Ptolemy II 0.3
Version:
$Id: DDEIOPort.java 57040 2010-01-27 20:52:32Z cxh $
Author:
John S. Davis II
See Also:
DDEReceiver, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (davisj)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
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
DDEIOPort()
          Construct a DDEIOPort with no container and an empty string as a name.
DDEIOPort(ComponentEntity container, java.lang.String name)
          Construct a DDEIOPort with a containing actor and the specified name that is neither an input nor an output.
DDEIOPort(ComponentEntity container, java.lang.String name, boolean isInput, boolean isOutput)
          Construct a DDEIOPort with a container and the specified name that is either an input, an output, or both, depending on the third and fourth arguments.
 
Method Summary
 void broadcast(Token token, Time sendTime)
          Send a token to all connected receivers by calling send on all of the remote receivers connected to this port.
 void send(int chIndex, Token token, Time sendTime)
          Send the specified token to all receivers connected to the specified channel.
 void setContainer(ComponentEntity container)
          Constrain DDEIOPorts to only be contained by non-atomic entities.
 
Methods inherited from class ptolemy.actor.TypedIOPort
_checkContainer, _checkLiberalLink, _checkLink, _checkType, _description, addTypeListener, attributeChanged, broadcast, broadcast, clone, 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, setContainer, 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, setName
 
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, 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
 

Constructor Detail

DDEIOPort

public DDEIOPort()
Construct a DDEIOPort with no container and an empty string as a name. The constructed port will be neither an input nor an output.


DDEIOPort

public DDEIOPort(ComponentEntity container,
                 java.lang.String name)
          throws IllegalActionException,
                 NameDuplicationException
Construct a DDEIOPort with a containing actor and the specified name that is neither an input nor an output. The specified container must implement the Actor interface, or an exception will be thrown.

Parameters:
container - The container actor.
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, or if the container is not atomic.
NameDuplicationException - If the name coincides with a port already in the container.

DDEIOPort

public DDEIOPort(ComponentEntity container,
                 java.lang.String name,
                 boolean isInput,
                 boolean isOutput)
          throws IllegalActionException,
                 NameDuplicationException
Construct a DDEIOPort with a container and the specified name that is either an input, an output, or both, depending on the third and fourth arguments. The specified container must implement the Actor interface or an exception will be thrown.

Parameters:
container - The container actor.
name - The name of the port.
isInput - True if this is to be an input port.
isOutput - True if this is to be an output 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. , or if the container is not atomic.
NameDuplicationException - If the name coincides with a port already in the container.
Method Detail

broadcast

public void broadcast(Token token,
                      Time sendTime)
               throws IllegalActionException,
                      NoRoomException
Send a token to all connected receivers by calling send on all of the remote receivers connected to this port. If there are no connected receivers, then nothing is sent. Associate a time stamp with the token that is equivalent to the specified sendTime parameter. Throw an IllegalActionException if the port is not an output. Throw a NoRoomException if one of the channels throws it.

Parameters:
token - The token to send
sendTime - The output time of the token being sent.
Throws:
IllegalActionException - If the port is not an output or the delay is negative.
NoRoomException - If a send to one of the channels throws it.

send

public void send(int chIndex,
                 Token token,
                 Time sendTime)
          throws IllegalActionException,
                 NoRoomException
Send the specified token to all receivers connected to the specified channel. The first receiver gets the actual token, while subsequent receivers get a clone. If there are no receivers, then do nothing. Associate a time stamp with the token that is equivalent to the specified sendTime parameter. Throw an IllegalActionException if the port is not an output. Throw a NoRoomException if one of the channels throws it.

Parameters:
chIndex - The index of the channel, between (inclusive) 0 to width-1.
token - The token to send.
sendTime - The output time of the token being sent.
Throws:
NoRoomException - If there is no room in the receiver.
IllegalActionException - If the port is not an output, if the index is out of range.

setContainer

public void setContainer(ComponentEntity container)
                  throws IllegalActionException,
                         NameDuplicationException
Constrain DDEIOPorts to only be contained by non-atomic entities.

Parameters:
container - The container in which to put this DDEIOPort.
Throws:
IllegalActionException - If the container argument is not atomic.
NameDuplicationException - If the name of this port is not unique with respect to other objects contained by this port's container.