Package ptolemy.moml
Class Vertex
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,Locatable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,Settable
,Singleton
public class Vertex extends Location
This attribute represents a waypoint in a relation. It extends Location, meaning that can be associated with a physical location in a visual rendition. It can optionally be associated with another instance of Vertex to indicate that there is a path from this one to the other one. Cyclic paths are not permitted, although currently that is not enforced by this class.- Since:
- Ptolemy II 0.4
- Version:
- $Id$
- Author:
- Steve Neuendorffer and Edward A. Lee
- Pt.AcceptedRating:
- Red (reviewmoderator)
- Pt.ProposedRating:
- Red (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
-
-
Field Summary
-
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
-
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_exportMoMLContents(java.io.Writer output, int depth)
Write a MoML description of the contents of this object, which in this base class is the attributes.void
addLinkedPort(Port port)
Add the specified port to the list of ports linked to this vertex.void
exportMoML(java.io.Writer output, int depth, java.lang.String name)
Write a MoML description of this object.Vertex
getLinkedVertex()
Return the other vertex to which there is a path from this vertex, or null if there is none.java.util.List
linkedPorts()
Get the list of ports linked to this vertex.void
removeLinkedPort(Port port)
Remove the specified port from the list of ports linked to this vertex.void
setLinkedVertex(Vertex vertex)
Set the other vertex to which there is a path from this vertex.java.lang.String
toString()
Get a description of the class, which is the class name and the location in parentheses.-
Methods inherited from class ptolemy.kernel.util.Location
_propagateValue, addValueListener, clone, getDefaultExpression, getDisplayName, getExpression, getLocation, getValueAsString, getVisibility, removeValueListener, setExpression, setLocation, setVisibility, validate
-
Methods inherited from class ptolemy.kernel.util.SingletonAttribute
setContainer
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _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, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, 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, uniqueName, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
Vertex
public Vertex(Workspace workspace)
Construct an attribute 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. The object is added to the directory of the workspace. Increment the version number of the workspace.- Parameters:
workspace
- The workspace that will list the attribute.
-
Vertex
public Vertex(Relation container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an attribute with the given name and position.- Parameters:
container
- The container.name
- The name of the vertex.- Throws:
IllegalActionException
- If the attribute is not of an acceptable class for the container.NameDuplicationException
- If the name coincides with an attribute already in the container.
-
-
Method Detail
-
addLinkedPort
public void addLinkedPort(Port port)
Add the specified port to the list of ports linked to this vertex.- Parameters:
port
- The port to link.
-
exportMoML
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
Write a MoML description of this object. MoML is an XML modeling markup language. In this class, the object is identified by the "property" element, with "name", "class", and "value" (XML) attributes. The body of the element, between the "<property>" and "</property>", is written using the _exportMoMLContents() protected method, so that derived classes can override that method alone to alter only how the contents of this object are described. The text that is written is indented according to the specified depth, with each line (including the last one) terminated with a newline. If the object is non-persistent, then write nothing.- Specified by:
exportMoML
in interfaceMoMLExportable
- Overrides:
exportMoML
in classLocation
- Parameters:
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use instead of the current name.- Throws:
java.io.IOException
- If an I/O error occurs.- See Also:
NamedObj.isPersistent()
-
getLinkedVertex
public Vertex getLinkedVertex()
Return the other vertex to which there is a path from this vertex, or null if there is none. Note that the paths are one directional, so this vertex might return null even though there is another vertex with a path to it.- Returns:
- The other vertex or null.
- See Also:
setLinkedVertex(Vertex)
-
linkedPorts
public java.util.List linkedPorts()
Get the list of ports linked to this vertex.- Returns:
- A list of ports connected to this vertex.
-
removeLinkedPort
public void removeLinkedPort(Port port)
Remove the specified port from the list of ports linked to this vertex. If the port is not linked, do nothing.- Parameters:
port
- The port to remove.
-
setLinkedVertex
public void setLinkedVertex(Vertex vertex)
Set the other vertex to which there is a path from this vertex. If the argument is null, remove the path.- Parameters:
vertex
- The vertex to link to this one.- See Also:
getLinkedVertex()
-
toString
public java.lang.String toString()
Get a description of the class, which is the class name and the location in parentheses.
-
_exportMoMLContents
protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOException
Write a MoML description of the contents of this object, which in this base class is the attributes. This method is called by _exportMoML(). If there are attributes, then each attribute description is indented according to the specified depth and terminated with a newline character.- Overrides:
_exportMoMLContents
in classNamedObj
- Parameters:
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.- Throws:
java.io.IOException
- If an I/O error occurs.- See Also:
NamedObj._exportMoMLContents(java.io.Writer, int)
-
-