ptolemy.actor.lib.hoc
Class MultiCompositePort

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

public class MultiCompositePort
extends TypedIOPort

A port for multi-composite actors. This port mirrors certain changes to it in the ports of the controller and refinements of the modal model. It is designed to work closely with RefinementPort, since changes to the ports can be initiated in either class.

Since:
Ptolemy II 5.2
Version:
$Id: MultiCompositePort.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee
See Also:
RefinementPort, MultiCompositeActor, Serialized Form
Accepted Rating:
Red (liuxj)
Proposed Rating:
Red (eal)

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
MultiCompositePort(ComponentEntity container, java.lang.String name)
          Construct a port with a containing actor and a name that is neither an input nor an output.
MultiCompositePort(Workspace workspace)
          Construct a port in the given workspace.
 
Method Summary
protected  void _checkContainer(Entity container)
          Override the base class to ensure that the proposed container is a MultiCompositeActor or null.
 int moveDown()
          Move this object down by one in the list of attributes of its container.
 int moveToFirst()
          Move this object to the first position in the list of attributes of the container.
 int moveToIndex(int index)
          Move this object to the specified position in the list of attributes of the container.
 int moveToLast()
          Move this object to the last position in the list of attributes of the container.
 int moveUp()
          Move this object up by one in the list of attributes of the container.
 void setContainer(Entity container)
          Override the base class so that if the port is being removed from the current container, then it is also removed from the controller and from each of the refinements.
 void setInput(boolean isInput)
          If the argument is true, make the port an input port.
 void setMultiport(boolean isMultiport)
          If the argument is true, make the port a multiport.
 void setName(java.lang.String name)
          Set the name of the port, and mirror the change in all the mirror ports.
 void setOutput(boolean isOutput)
          If the argument is true, make the port an output port.
 
Methods inherited from class ptolemy.actor.TypedIOPort
_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, setDefaultWidth, 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, 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, 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

MultiCompositePort

public MultiCompositePort(Workspace workspace)
                   throws IllegalActionException
Construct a port in the given workspace.

Parameters:
workspace - The workspace.
Throws:
IllegalActionException - If the port is not of an acceptable class for the container, or if the container does not implement the TypedActor interface.

MultiCompositePort

public MultiCompositePort(ComponentEntity container,
                          java.lang.String name)
                   throws IllegalActionException,
                          NameDuplicationException
Construct a port with a containing actor and a name that is neither an input nor an output. The specified container must implement the TypedActor 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 TypedActor interface.
NameDuplicationException - If the name coincides with a port already in the container.
Method Detail

moveDown

public int moveDown()
             throws IllegalActionException
Move this object down by one in the list of attributes of its container. If this object is already last, do nothing. This method overrides the base class to mirror the change in any mirror ports. Increment the version of the workspace.

Specified by:
moveDown in interface Moveable
Overrides:
moveDown in class Port
Returns:
The index of the specified object prior to moving it, or -1 if it is not moved.
Throws:
IllegalActionException - If this object has no container.

moveToFirst

public int moveToFirst()
                throws IllegalActionException
Move this object to the first position in the list of attributes of the container. If this object is already first, do nothing. Increment the version of the workspace. This method overrides the base class to mirror the change in any mirror ports.

Specified by:
moveToFirst in interface Moveable
Overrides:
moveToFirst in class Port
Returns:
The index of the specified object prior to moving it, or -1 if it is not moved.
Throws:
IllegalActionException - If this object has no container.

moveToIndex

public int moveToIndex(int index)
                throws IllegalActionException
Move this object to the specified position in the list of attributes of the container. If this object is already at the specified position, do nothing. This method overrides the base class to mirror the change in any mirror ports. Increment the version of the workspace.

Specified by:
moveToIndex in interface Moveable
Overrides:
moveToIndex in class Port
Parameters:
index - The position to move this object to.
Returns:
The index of the specified object prior to moving it, or -1 if it is not moved.
Throws:
IllegalActionException - If this object has no container or if the index is out of bounds.

moveToLast

public int moveToLast()
               throws IllegalActionException
Move this object to the last position in the list of attributes of the container. If this object is already last, do nothing. This method overrides the base class to mirror the change in any mirror ports. Increment the version of the workspace.

Specified by:
moveToLast in interface Moveable
Overrides:
moveToLast in class Port
Returns:
The index of the specified object prior to moving it, or -1 if it is not moved.
Throws:
IllegalActionException - If this object has no container.

moveUp

public int moveUp()
           throws IllegalActionException
Move this object up by one in the list of attributes of the container. If this object is already first, do nothing. This method overrides the base class to mirror the change in any mirror ports. Increment the version of the workspace.

Specified by:
moveUp in interface Moveable
Overrides:
moveUp in class Port
Returns:
The index of the specified object prior to moving it, or -1 if it is not moved.
Throws:
IllegalActionException - If this object has no container.

setContainer

public void setContainer(Entity container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class so that if the port is being removed from the current container, then it is also removed from the controller and from each of the refinements. This method is write-synchronized on the workspace.

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

setInput

public void setInput(boolean isInput)
              throws IllegalActionException
If the argument is true, make the port an input port. If the argument is false, make the port not an input port. This method overrides the base class to make the same change on the mirror ports in the controller and state refinments. This method invalidates the schedule and resolved types of the director of the container, if there is one. It is write-synchronized on the workspace, and increments the version of the workspace.

Overrides:
setInput in class IOPort
Parameters:
isInput - True to make the port an input.
Throws:
IllegalActionException - If changing the port status is not permitted.

setMultiport

public void setMultiport(boolean isMultiport)
                  throws IllegalActionException
If the argument is true, make the port a multiport. If the argument is false, make the port not a multiport. This method overrides the base class to make the same change on the mirror ports in the controller and state refinments. This method invalidates the schedule and resolved types of the director of the container, if there is one. It is write-synchronized on the workspace, and increments the version of the workspace.

Overrides:
setMultiport in class IOPort
Parameters:
isMultiport - True to make the port a multiport.
Throws:
IllegalActionException - If changing the port status is not permitted.

setName

public void setName(java.lang.String name)
             throws IllegalActionException,
                    NameDuplicationException
Set the name of the port, and mirror the change in all the mirror ports. This method is write-synchronized on the workspace, and increments the version of the workspace.

Specified by:
setName in interface Nameable
Overrides:
setName in class Port
Parameters:
name - The new name.
Throws:
IllegalActionException - If the name has a period.
NameDuplicationException - If there is already a port with the same name in the container.
See Also:
NamedObj.getName(), NamedObj.getName(NamedObj)

setOutput

public void setOutput(boolean isOutput)
               throws IllegalActionException
If the argument is true, make the port an output port. If the argument is false, make the port not an output port. This method overrides the base class to make the same change on the mirror ports in the controller and state refinments. This method invalidates the schedule and resolved types of the director of the container, if there is one. It is write-synchronized on the workspace, and increments the version of the workspace.

Overrides:
setOutput in class IOPort
Parameters:
isOutput - True to make the port an output.
Throws:
IllegalActionException - If changing the port status is not permitted.

_checkContainer

protected void _checkContainer(Entity container)
                        throws IllegalActionException
Override the base class to ensure that the proposed container is a MultiCompositeActor or null.

Overrides:
_checkContainer in class TypedIOPort
Parameters:
container - The proposed container.
Throws:
IllegalActionException - If the proposed container is not a TypedActor, or if the base class throws it.