Package ptolemy.cg.lib.syntactic
Class SyntacticPort
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.Port
-
- ptolemy.kernel.ComponentPort
-
- ptolemy.cg.lib.syntactic.SyntacticPort
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class SyntacticPort extends ComponentPort
Represent ComponentPorts syntactically in SyntacticNodes. Ports in models that can be interpreted as input or output ports can be represented referentially by this object. The semantic information about direction is not retained in the reference but represented by the context of the reference in an input or output list in a SyntacticTerm. Multiports are split into series of SyntacticPorts. Bidirectional ports are split into pairs of SyntacticPorts.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Chris Shaver
- Pt.AcceptedRating:
- red
- Pt.ProposedRating:
- red (shaver)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SyntacticPort.IOType
Represent IO type for ports.-
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 SyntacticPort()
Construct SyntacticPort.SyntacticPort(SyntacticNode container, Port port, boolean direction, java.lang.String name)
Construct SyntacticPort with given container and name.SyntacticPort(Workspace workspace)
Construct SyntacticPort with given workspace.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getChannel()
Get the channel of the represented port.SyntacticPort
getConnectedPort()
Get the connected port from a given port.SyntacticNode
getNode()
Get node in which port is contained.Port
getRepresentedPort()
Get the port represented by the Syntactic Port.SyntacticPort.IOType
getType()
Gets the IOType of the port.boolean
isEmpty()
Decide whether the port is disconnected.boolean
isInput()
Decide whether the port is representationally an input port.boolean
isOutput()
Decide whether the port is representationally an output port.static boolean
isPortExterior(Port port, CompositeEntity entity)
Decide whether a port is exterior in the given entity.boolean
isRepresentative()
Decide whether the port represents an actual port.static SyntacticPort.IOType
portType(Port port)
Gets the IOType of a given port.static SyntacticPort.IOType
portType(Port port, CompositeEntity entity)
Gets the IOType of a given port with reference to a composite entity.static java.lang.Integer
portWidth(Port port)
Gets the width of a Port.void
setChannel(int channel)
Set the channel of the represented port.-
Methods inherited from class ptolemy.kernel.ComponentPort
_checkContainer, _checkLiberalLink, _checkLink, _deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _description, _isInsideLinkable, clone, 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
-
SyntacticPort
public SyntacticPort()
Construct SyntacticPort.
-
SyntacticPort
public SyntacticPort(Workspace workspace)
Construct SyntacticPort with given workspace.- Parameters:
workspace
- Workspace to add SyntacticPort to.
-
SyntacticPort
public SyntacticPort(SyntacticNode container, Port port, boolean direction, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct SyntacticPort with given container and name. The caller can associate the syntactic port with an actual port. The caller must determine if the port is input or output and the represented port, if one exist, will be treated inferentially as such.- Parameters:
container
- SyntacticNode in which this port is added.port
- Port referred to by this SyntacticPort.direction
- True if input, false if output.name
- Name of this 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.
-
-
Method Detail
-
getConnectedPort
public SyntacticPort getConnectedPort()
Get the connected port from a given port. If the graph is not made bijective this gives the first. If there are no ports or no SyntacticPorts null is returned.- Returns:
- An immediately connected port or null.
-
getNode
public SyntacticNode getNode()
Get node in which port is contained.- Returns:
- node in which port is contained or null if none.
-
setChannel
public void setChannel(int channel)
Set the channel of the represented port. Each SyntacticPort only represents a single channel of the represented port.- Parameters:
channel
- The channel of the represented port.- See Also:
getChannel()
-
getRepresentedPort
public Port getRepresentedPort()
Get the port represented by the Syntactic Port.- Returns:
- represented port.
-
getChannel
public int getChannel()
Get the channel of the represented port.- Returns:
- represented channel of the port.
- See Also:
setChannel(int)
-
isRepresentative
public boolean isRepresentative()
Decide whether the port represents an actual port. If false, the port is purely syntactic.- Returns:
- whether the port is representative.
-
isInput
public boolean isInput()
Decide whether the port is representationally an input port.- Returns:
- whether the port is an input port.
-
isOutput
public boolean isOutput()
Decide whether the port is representationally an output port.- Returns:
- whether the port is an output port.
-
isEmpty
public boolean isEmpty()
Decide whether the port is disconnected.- Returns:
- whether the port is disconnected.
-
getType
public SyntacticPort.IOType getType()
Gets the IOType of the port. For ports that represent input/output ports, each SyntacticPort will be set to the appropriate type for the part of the port it represents.- Returns:
- IOType of the port.
-
portType
public static SyntacticPort.IOType portType(Port port)
Gets the IOType of a given port.- Parameters:
port
- Port to find the type of.- Returns:
- IOType of given port.
-
isPortExterior
public static boolean isPortExterior(Port port, CompositeEntity entity)
Decide whether a port is exterior in the given entity. This should be passed the model during analysis.- Parameters:
port
- Port to check for exteriority.entity
- Entity to check inside of.- Returns:
- whether port is exterior for the given entity.
-
portType
public static SyntacticPort.IOType portType(Port port, CompositeEntity entity)
Gets the IOType of a given port with reference to a composite entity. If a port is an exterior port of the entity, its IOType is reversed to reflect the role it plays on the inside of the composite.- Parameters:
port
- Port to find the type of.entity
- Entity to check inside of.- Returns:
- IOType of the port.
-
portWidth
public static java.lang.Integer portWidth(Port port) throws IllegalActionException
Gets the width of a Port.- Parameters:
port
- Port to find the width of.- Returns:
- the width of the port or null if not a port.
- Throws:
IllegalActionException
- If thrown while getting the width.
-
-