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.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- DistributedTypedIORelation
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: TypedIORelation.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Yuhong Xiong
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
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 |
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 |
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, _setInferredWidth, _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.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _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 |
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.
_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 class ComponentRelation
- 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 class IORelation
- 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 class IORelation
- 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.