Package ptolemy.actor
Class TypedIORelation
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.Relation
-
- ptolemy.kernel.ComponentRelation
-
- ptolemy.actor.IORelation
-
- ptolemy.actor.TypedIORelation
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
DistributedTypedIORelation
,TestTypedIORelation
public class TypedIORelation extends IORelation
This class overrides some of the methods in IORelation to ensure that TypedIOPorts are only connected to TypedIOPorts. I.e., Instances of TypedIORelation can only be linked to instances of TypedIOPort. Derived classes may further constrain this to subclasses of TypedIOPort. Such derived classes should override the protected method _checkPort() to throw an exception.To link a TypedIOPort to a TypedIORelation, use the link() or liberalLink() method in the TypedIOPort class. To remove a link, use the unlink() method.
The container for instances of this class can only be instances of TypedCompositeActor. Derived classes may wish to further constrain the container to subclasses of TypedComponentEntity. To do this, they should override the _checkContainer() method.
- Since:
- Ptolemy II 0.2
- Version:
- $Id$
- Author:
- Yuhong Xiong
- Pt.AcceptedRating:
- Green (liuxj)
- Pt.ProposedRating:
- Green (yuhong)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.IORelation
_USE_NEW_WIDTH_INFERENCE_ALGO, CONFIGURATION, width, WIDTH_TO_INFER
-
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 TypedIORelation()
Construct a relation in the default workspace with an empty string as its name.TypedIORelation(CompositeEntity container, java.lang.String name)
Construct a relation with the given name contained by the specified entity.TypedIORelation(Workspace workspace)
Construct a relation in the specified workspace with an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_checkContainer(CompositeEntity container)
Override the method in the super class to constrain the container to be an instance of TypedCompositeActor, or to be null.protected void
_checkPort(Port port)
Throw an exception if the specified port cannot be linked to this relation (is not of class TypedIOPort).protected void
_checkRelation(Relation relation, boolean symmetric)
Throw an exception if the specified relation is not an instance of TypedIORelation.-
Methods inherited from class ptolemy.actor.IORelation
_description, _skipWidthInference, attributeChanged, clone, deepReceivers, getWidth, isWidthFixed, linkedDestinationPortList, linkedDestinationPortList, linkedDestinationPorts, linkedDestinationPorts, linkedSourcePortList, linkedSourcePortList, linkedSourcePorts, linkedSourcePorts, needsWidthInference, setContainer, setWidth
-
Methods inherited from class ptolemy.kernel.ComponentRelation
_propagateExistence, deepLinkedPortList, deepLinkedPorts, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, unlinkAll
-
Methods inherited from class ptolemy.kernel.Relation
_getContainedObject, link, linkedObjectsList, linkedPortList, linkedPortList, linkedPorts, linkedPorts, numLinks, relationGroupList, 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, 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
-
TypedIORelation
public TypedIORelation()
Construct a relation in the default workspace with an empty string as its name. Add the relation to the directory of the workspace.
-
TypedIORelation
public TypedIORelation(Workspace workspace)
Construct a relation 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. Add the relation to the workspace directory.- Parameters:
workspace
- The workspace that will list the relation.
-
TypedIORelation
public TypedIORelation(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a relation with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This relation 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. This constructor write-synchronizes on the workspace.- Parameters:
container
- The container.name
- The name of the relation.- Throws:
IllegalActionException
- If the container is incompatible with this relation.NameDuplicationException
- If the name coincides with a relation already in the container.
-
-
Method Detail
-
_checkContainer
protected void _checkContainer(CompositeEntity container) throws IllegalActionException
Override the method in the super class to constrain the container to be an instance of TypedCompositeActor, or to be null.- Overrides:
_checkContainer
in classComponentRelation
- Parameters:
container
- The proposed container.- Throws:
IllegalActionException
- If the container is not a TypedCompositeActor or null, or this relation and the container are not in the same workspace.
-
_checkPort
protected void _checkPort(Port port) throws IllegalActionException
Throw an exception if the specified port cannot be linked to this relation (is not of class TypedIOPort).- Overrides:
_checkPort
in classIORelation
- Parameters:
port
- The candidate port to link to.- Throws:
IllegalActionException
- If the port is not an TypedIOPort.
-
_checkRelation
protected void _checkRelation(Relation relation, boolean symmetric) throws IllegalActionException
Throw an exception if the specified relation is not an instance of TypedIORelation.- Overrides:
_checkRelation
in classIORelation
- Parameters:
relation
- The relation to link to.symmetric
- If true, the call _checkRelation on the specified relation with this as an argument.- Throws:
IllegalActionException
- If this port has no container, or if this port is not an acceptable port for the specified relation.
-
-