ptolemy.domains.dde.kernel
Class DDEIOPort

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

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,v 1.33 2004/04/13 03:28:28 cxh Exp $
Author:
John S. Davis II
See Also:
DDEReceiver, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (davisj)

Nested Class Summary
 
Nested classes 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
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
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, double 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, double 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
 
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, setContainer, 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, setName
 
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
 

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,
                      double 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,
                 double 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.

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.