|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.Relation
public class Relation
A Relation links ports, and therefore the entities that contain them. To link a port to a relation, use the link() method in the Port class. To remove a link, use the unlink() method in the Port class.
Relations can also be linked to other Relations. To create such a link, use the link() method of this class. To remove such a link, use the unlink() method. A group of linked relations behaves exactly as if it were one relation directly linked to all the ports linked to by each relation. In particular, the connectedPortList() method of the Port class returns the same list whether a single relation is used or a relation group. The order in which the ports are listed is the order in which links were made between the port and relations in the relation group. It is not relevant which relation in a relation group the port links to.
Derived classes may wish to disallow links under certain circumstances, for example if the proposed port is not an instance of an appropriate subclass of Port, or if the relation cannot support any more links. Such derived classes should override the protected method _checkPort() or _checkRelation() to throw an exception.
Port
,
Entity
,
Serialized Form
Green (acataldo) |
Green (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
protected CrossRefList |
_linkList
The list of Ports and Relations that are linked to this Relation. |
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 | |
---|---|
Relation()
Construct a relation in the default workspace with an empty string as its name. |
|
Relation(java.lang.String name)
Construct a relation in the default workspace with the given name. |
|
Relation(Workspace workspace)
Construct a relation in the given workspace with an empty string as a name. |
|
Relation(Workspace workspace,
java.lang.String name)
Construct a relation in the given workspace with the given name. |
Method Summary | |
---|---|
protected void |
_checkPort(Port port)
Throw an exception if the specified port cannot be linked to this relation. |
protected void |
_checkRelation(Relation relation,
boolean symmetric)
Check that this relation is compatible with the specified relation. |
protected java.lang.String |
_description(int detail,
int indent,
int bracket)
Return a description of the object. |
protected NamedObj |
_getContainedObject(NamedObj container,
java.lang.String relativeName)
Get a relation with the specified name in the specified container. |
private java.util.List |
_linkedPortList(Port exceptPort,
java.util.Set exceptRelations)
List the linked ports except the exceptPort and those linked via the relations in the exceptRelations list. |
private void |
_relationGroup(java.util.List list)
Append to the specified list all relations in the relation group with this one that are not already on the list. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
void |
link(Relation relation)
Link this relation with another relation. |
java.util.List |
linkedObjectsList()
Return a list of the objects directly linked to this relation (ports and relations). |
java.util.List |
linkedPortList()
List the ports linked to any relation in this relation's group. |
java.util.List |
linkedPortList(Port except)
List the ports linked to any relation in this relation's group except the specified port. |
java.util.Enumeration |
linkedPorts()
Deprecated. Use linkedPortList() instead. |
java.util.Enumeration |
linkedPorts(Port except)
Deprecated. Use linkedPortList(Port) instead. |
int |
numLinks()
Return the number of links to ports, either directly or indirectly via other relations in the relation group. |
java.util.List |
relationGroupList()
Return the list of relations in the relation group containing this relation. |
void |
unlink(Relation relation)
Unlink the specified Relation. |
void |
unlinkAll()
Unlink all ports and relations that are directly linked to this relation. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected CrossRefList _linkList
Constructor Detail |
---|
public Relation()
public Relation(java.lang.String name) throws IllegalActionException
name
- Name of this object.
IllegalActionException
- If the name has a period.public Relation(Workspace workspace)
workspace
- The workspace for synchronization and version tracking.public Relation(Workspace workspace, java.lang.String name) throws IllegalActionException
workspace
- Workspace for synchronization and version trackingname
- Name of this object.
IllegalActionException
- If the name has a period.Method Detail |
---|
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class NamedObj
workspace
- The workspace for the cloned object.
java.lang.CloneNotSupportedException
- If one of the attributes cannot
be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void link(Relation relation) throws IllegalActionException
relation
- The relation to link to this relation.
IllegalActionException
- If the link would cross levels of
the hierarchy, or the relation is incompatible,
or this relation has no container, or this relation is not in the
same workspace as the relation.public java.util.List linkedObjectsList()
public java.util.List linkedPortList()
public java.util.List linkedPortList(Port except)
except
- Port to exclude from the list.
public java.util.Enumeration linkedPorts()
public java.util.Enumeration linkedPorts(Port except)
except
- Port to exclude from the enumeration.
public int numLinks()
linkedPortList()
public java.util.List relationGroupList()
public void unlink(Relation relation)
relation
- The relation to unlink.public void unlinkAll()
protected void _checkPort(Port port) throws IllegalActionException
port
- The port to link to.
IllegalActionException
- Not thrown in this base class.protected void _checkRelation(Relation relation, boolean symmetric) throws IllegalActionException
relation
- The relation to link to.symmetric
- If true, the call _checkRelation on the specified
relation with this as an argument.
IllegalActionException
- If this relation has no container,
or if this relation is not an acceptable relation for the specified
relation.protected java.lang.String _description(int detail, int indent, int bracket) throws IllegalActionException
_description
in class NamedObj
detail
- The level of detail.indent
- The amount of indenting.bracket
- The number of surrounding brackets (0, 1, or 2).
IllegalActionException
protected NamedObj _getContainedObject(NamedObj container, java.lang.String relativeName) throws IllegalActionException
_getContainedObject
in class NamedObj
relativeName
- The name relative to the container.container
- The container expected to contain the object, which
must be an instance of CompositeEntity.
IllegalActionException
- If the object exists
and has the wrong class, or if the specified container is not
an instance of CompositeEntity.private java.util.List _linkedPortList(Port exceptPort, java.util.Set exceptRelations)
exceptPort
- A port to exclude, or null to not
specify one.exceptRelations
- Set of relations to exclude.
private void _relationGroup(java.util.List list)
list
- The list to append to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |