ptolemy.domains.wireless.kernel
Class ChannelPort

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.wireless.kernel.WirelessIOPort
                          extended by ptolemy.domains.wireless.kernel.ChannelPort
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class ChannelPort
extends WirelessIOPort

This port is used in a channel to mediate type constraints between senders and receivers on a wireless channel. The way it works is by pretending that it receives data from the sender and sends data to the receiver. It does not actually get involved in the transmission of data (that is handled by the transmit() method of the channel). This port is always both an input and an output. This port is not persistent and is always hidden in a user interface.

NOTE: Someday, perhaps this port will be augmented to mediate the communication and facilitate the construction of channel models as composite actors instead of atomic actors).

Since:
Ptolemy II 4.0
Version:
$Id: ChannelPort.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Yellow (cxh)
Proposed Rating:
Green (cxh)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  java.util.List _sinkPortList
           
private  long _sinkPortListVersion
           
private  java.util.List _sourcePortList
           
private  long _sourcePortListVersion
           
 
Fields inherited from class ptolemy.domains.wireless.kernel.WirelessIOPort
insideChannel, insideTransmitProperties, outsideChannel, outsideTransmitProperties
 
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
ChannelPort(ComponentEntity container, java.lang.String name)
          Construct a port with the specified container and name that is both an input and an output.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the object into the specified workspace.
 int numberOfSinks()
          Return the number of sink ports that can potentially receive data from the containing channel.
 int numberOfSources()
          Return the number of source ports that can potentially send data to the containing channel.
 void setContainer(Entity container)
          Override the base class to ensure that the proposed container implements the WirelessChannel interface.
 java.util.List sinkPortList()
          Return a list of the ports that can potentially accept data from the containing channel.
 java.util.List sourcePortList()
          Return a list of the ports that can potentially send data to the containing channel.
 
Methods inherited from class ptolemy.domains.wireless.kernel.WirelessIOPort
_insideIsWireless, _outsideIsWireless, attributeChanged, broadcast, broadcast, broadcastClear, createReceivers, getInsideChannel, getInsideReceivers, getOutsideChannel, getProperties, getPropertiesInside, getReceivers, getWidth, getWidthInside, hasRoom, hasRoomInside, insideSinkPortList, insideSourcePortList, send, send, sendClear, sendClearInside, sendInside
 
Methods inherited from class ptolemy.actor.TypedIOPort
_checkContainer, _checkLiberalLink, _checkLink, _checkType, _description, addTypeListener, convert, getType, getTypeTerm, isTypeAcceptable, removeTypeListener, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.IOPort
_checkLiberalLink, _exportMoMLContents, _getInsideWidth, _getOutsideWidth, _getReceiversLinkedToGroup, _newInsideReceiver, _newReceiver, _notifyPortEventListeners, _removeReceivers, addIOPortEventListener, checkWidthConstraints, deepConnectedInPortList, deepConnectedInPorts, deepConnectedOutPortList, deepConnectedOutPorts, deepGetReceivers, get, get, getChannelForReceiver, getCurrentTime, getDefaultWidth, getInside, getModelTime, getReceivers, getReceivers, getRelationIndex, getRemoteReceivers, getRemoteReceivers, getWidthFromConstraints, hasToken, hasToken, hasTokenInside, hasWidthConstraints, insertLink, isInput, isInsideConnected, isKnown, isKnown, isKnownInside, isMultiport, isOutput, isOutsideConnected, liberalLink, link, removeIOPortEventListener, setDefaultWidth, setInput, setMultiport, setOutput, setWidthEquals, setWidthEquals, 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
 

Field Detail

_sourcePortList

private java.util.List _sourcePortList

_sourcePortListVersion

private long _sourcePortListVersion

_sinkPortList

private java.util.List _sinkPortList

_sinkPortListVersion

private long _sinkPortListVersion
Constructor Detail

ChannelPort

public ChannelPort(ComponentEntity container,
                   java.lang.String name)
            throws IllegalActionException,
                   NameDuplicationException
Construct a port with the specified container and name that is both an input and an output.

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.
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 object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there).

Overrides:
clone in class WirelessIOPort
Parameters:
workspace - The workspace for the cloned object.
Returns:
The new Attribute.
Throws:
java.lang.CloneNotSupportedException - Not thrown in this base class
See Also:
NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)

numberOfSinks

public int numberOfSinks()
Return the number of sink ports that can potentially receive data from the containing channel.

Overrides:
numberOfSinks in class WirelessIOPort
Returns:
The number of ports that can receive data from this one.
See Also:
IOPort.sinkPortList(), IOPort.numberOfSources(), IOPort.getWidth()

numberOfSources

public int numberOfSources()
Return the number of source ports that can potentially send data to the containing channel.

Overrides:
numberOfSources in class WirelessIOPort
Returns:
The number of ports that can send data to this one.
See Also:
IOPort.sourcePortList(), IOPort.numberOfSinks(), IOPort.getWidth()

setContainer

public void setContainer(Entity container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class to ensure that the proposed container implements the WirelessChannel interface.

Overrides:
setContainer in class IOPort
Parameters:
container - The proposed container.
Throws:
IllegalActionException - If the proposed container is not a ComponentEntity, doesn't implement WirelessChannel, or has no name, or the port and container are not in the same workspace.
NameDuplicationException - If the container already has a port with the name of this port.
See Also:
Port.getContainer(), Port._checkContainer(Entity)

sinkPortList

public java.util.List sinkPortList()
Return a list of the ports that can potentially accept data from the containing channel. This includes all input ports that use that channel on the outside and all output ports that use the channel on the inside.

Overrides:
sinkPortList in class WirelessIOPort
Returns:
A list of WirelessIOPort objects.
See Also:
IOPort.getRemoteReceivers()

sourcePortList

public java.util.List sourcePortList()
Return a list of the ports that can potentially send data to the containing channel. This includes all output ports that use that channel on the outside and all input ports that use it on the inside.

Overrides:
sourcePortList in class WirelessIOPort
Returns:
A list of IOPort objects.