|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.Relation
ptolemy.kernel.ComponentRelation
This class defines a relation supporting hierarchy (clustered graphs). Specifically, a method is added for defining a container and for performing deep traversals of a graph. Most importantly, however, instances of this class refuse to link to ports that are not instances of ComponentPort. Thus, this class ensures that ComponentPort instances are only connected to other ComponentPort instances.
Derived classes may wish to further constrain linked ports to a subclass of ComponentPort, or to disallow links under other circumstances, for example if the relation cannot support any more links. Such derived classes should override the protected method _checkPort() to throw an exception.
To link a ComponentPort to a ComponentRelation, use the link() or liberalLink() method in the ComponentPort class. To remove a link, use the unlink() method.
The container for instances of this class can only be instances of ComponentEntity. Derived classes may wish to further constrain the container to subclasses of ComponentEntity. To do this, they should override the protected _checkContainer() method.
| Green (johnr) |
| Green (eal) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Field Summary |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Constructor Summary | |
ComponentRelation()
Construct a relation in the default workspace with an empty string as its name. |
|
ComponentRelation(CompositeEntity container,
java.lang.String name)
Construct a relation with the given name contained by the specified entity. |
|
ComponentRelation(Workspace workspace)
Construct a relation in the specified workspace with an empty string as a name. |
|
| Method Summary | |
protected void |
_checkContainer(CompositeEntity container)
Check that the specified container is of a suitable class for this relation. |
protected void |
_checkPort(Port port)
Throw an exception if the specified port cannot be linked to this relation (is not of class ComponentPort). |
protected NamedObj |
_propagateExistence(NamedObj container)
Propagate existence of this object to the specified object. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
java.util.List |
deepLinkedPortList()
Deeply list the ports linked to this relation. |
java.util.Enumeration |
deepLinkedPorts()
Deprecated. Use deepLinkedPortList() instead. |
NamedObj |
getContainer()
Get the container entity. |
void |
setContainer(CompositeEntity container)
Specify the container entity, adding the relation to the list of relations in the container. |
void |
setName(java.lang.String name)
Set the name of the ComponentRelation. |
void |
unlinkAll()
Override the base class to break inside links on ports as well as outside lists. |
| Methods inherited from class ptolemy.kernel.Relation |
_description, _getContainedObject, _getPortList, linkedPortList, linkedPortList, linkedPorts, linkedPorts, numLinks |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ComponentRelation()
public ComponentRelation(Workspace workspace)
workspace - The workspace that will list the relation.
public ComponentRelation(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name of the relation.
IllegalActionException - If the container is incompatible
with this relation.
NameDuplicationException - If the name coincides with
a relation already in the container.| Method Detail |
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
clone in class Relationworkspace - The workspace for the cloned object.
java.lang.CloneNotSupportedException - If one or more of the attributes
cannot be cloned.public java.util.List deepLinkedPortList()
public java.util.Enumeration deepLinkedPorts()
public NamedObj getContainer()
getContainer in interface NameablegetContainer in class NamedObjsetContainer(CompositeEntity)
public void setContainer(CompositeEntity container)
throws IllegalActionException,
NameDuplicationException
container - The proposed container.
IllegalActionException - If this entity and the container
are not in the same workspace, or if
a contained Settable becomes invalid and the error handler
throws it.
NameDuplicationException - If the name collides with a name
already on the contents list of the container.getContainer()
public void setName(java.lang.String name)
throws IllegalActionException,
NameDuplicationException
setName in interface NameablesetName in class NamedObjname - The new name.
IllegalActionException - If the name has a period.
NameDuplicationException - If there is already a relation
with the same name in the container.NamedObj.getDerivedLevel()public void unlinkAll()
unlinkAll in class Relation
protected void _checkContainer(CompositeEntity container)
throws IllegalActionException
container - The proposed container.
IllegalActionException - If the container is not of
an acceptable class. Not thrown in this base class.
protected void _checkPort(Port port)
throws IllegalActionException
_checkPort in class Relationport - The port to link to.
IllegalActionException - If the port is not a ComponentPort.
protected NamedObj _propagateExistence(NamedObj container)
throws IllegalActionException
_propagateExistence in class NamedObjcontainer - Object to contain the new object.
IllegalActionException - If the object
cannot be cloned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||