Package ptolemy.component
Class MethodCallPort
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.Port
-
- ptolemy.kernel.ComponentPort
-
- ptolemy.component.MethodCallPort
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class MethodCallPort extends ComponentPort
A port for use in the component domain.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Yang Zhao
- Pt.AcceptedRating:
- red(cxh)
- Pt.ProposedRating:
- yellow(cxh)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.kernel.Port
_insideLinks, _relationsList
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description MethodCallPort()
Construct a port in the default workspace with an empty string as its name.MethodCallPort(ComponentEntity container, java.lang.String name)
Construct a port with the given name contained by the specified entity.MethodCallPort(ComponentEntity container, java.lang.String name, boolean isProvidedPort)
Construct an IOPort with a container and a name that is either an input, an output, or both, depending on the third and fourth arguments.MethodCallPort(Workspace workspace)
Construct a port in the specified workspace with an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleToken
call(TupleToken arguments)
Call the method associated with this port with the specified arguments.java.lang.Object
clone(Workspace workspace)
Clone the object into the specified workspace.boolean
isProvider()
Return true if this port provides the method, vs.void
setProvider(boolean isProvider)
Call with argument true to specify that this port provides the method, and call with argument false to specify that it requires the method.-
Methods inherited from class ptolemy.kernel.ComponentPort
_checkContainer, _checkLiberalLink, _checkLink, _deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _description, _isInsideLinkable, deepConnectedPortList, deepConnectedPorts, deepInsidePortList, deepInsidePorts, insertInsideLink, insertLink, insidePortList, insidePorts, insideRelationList, insideRelations, isDeeplyConnected, isInsideGroupLinked, isInsideLinked, isOpaque, liberalLink, link, numInsideLinks, setContainer, unlink, unlinkAll, unlinkAllInside, unlinkInside, unlinkInside
-
Methods inherited from class ptolemy.kernel.Port
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isGroupLinked, isLinked, linkedRelationList, linkedRelations, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, numLinks, setName, unlink
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
MethodCallPort
public MethodCallPort()
Construct a port in the default workspace with an empty string as its name. Increment the version number of the workspace. The object is added to the workspace directory.
-
MethodCallPort
public MethodCallPort(Workspace workspace)
Construct a port in the specified workspace with an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. The object is added to the workspace directory. Increment the version number of the workspace.- Parameters:
workspace
- The workspace that will list the port.
-
MethodCallPort
public MethodCallPort(ComponentEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a port with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This port will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.- Parameters:
container
- The container entity.name
- The name of the port.- Throws:
IllegalActionException
- If the port is not of an acceptable class for the container.NameDuplicationException
- If the name coincides with a port already in the container.
-
MethodCallPort
public MethodCallPort(ComponentEntity container, java.lang.String name, boolean isProvidedPort) throws IllegalActionException, NameDuplicationException
Construct an IOPort with a container and a 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.isProvidedPort
- True if this port provides the method.- 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). The result is a new port with no connections and no container.- Overrides:
clone
in classComponentPort
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- A new ComponentPort.
- Throws:
java.lang.CloneNotSupportedException
- If one or more of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
call
public TupleToken call(TupleToken arguments)
Call the method associated with this port with the specified arguments.If this port is a provider, as indicated by @link{#isProvider()}, then this method returns TupleToken.VOID, an empty tuple token. Subclasses should override this method to perform whatever functionality is associated with this method.
If this port is not a provider of this method, then this method delegates the call to all ports to which this port is deeply connected that are providers. The order in which those calls are performed is determined by the order in which connections are made. The returned token is a concatenation of the returned values of all the called methods. If there is nothing connected, then this method will return TupleToken.VOID.
- Parameters:
arguments
- The arguments to the method.- See Also:
isProvider()
,TupleToken.VOID
-
isProvider
public boolean isProvider()
Return true if this port provides the method, vs. requires the method. By default, this method returns false, meaning that the port requires rather than provides the method.- Returns:
- True if this port provides the method.
- See Also:
setProvider(boolean)
,MethodCallPort(ComponentEntity, String, boolean)
,call(TupleToken)
-
setProvider
public void setProvider(boolean isProvider)
Call with argument true to specify that this port provides the method, and call with argument false to specify that it requires the method.
-
-