Package ptolemy.vergil.kernel
Class CompositePtolemyModel
- java.lang.Object
-
- ptolemy.vergil.kernel.CompositePtolemyModel
-
- All Implemented Interfaces:
CompositeModel
public class CompositePtolemyModel extends java.lang.Object implements CompositeModel
A diva node model for a Ptolemy II composite entity. Each element of the graph model is represented by an instance of Locatable, which is an attribute contained by a Ptolemy II object. If a Ptolemy II object is found that does not contain a Locatable, then one is created if needed. The graph model consists of locations for various elements in the composite. In particular, one location will be included for each contained entity, port, director, and visible attribute. In each case except visible attributes, if there is no location, then a default location is created. Visible attributes are included in the graph only if they already contain a location. In addition, for any relation that links more than two ports and does not contain a Vertex, this class will create a Vertex.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Steve Neuendorffer and Edward A. Lee
- See Also:
Location
- Pt.AcceptedRating:
- Red (johnr)
- Pt.ProposedRating:
- Yellow (neuendor)
-
-
Constructor Summary
Constructors Constructor Description CompositePtolemyModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Locatable
_getLocation(NamedObj object)
Return the location attribute contained in the given object, or a new location contained in the given object if there was no location.int
getNodeCount(java.lang.Object composite)
Return the number of nodes contained in the graph for the specified composite.java.util.Iterator
nodes(java.lang.Object composite)
Return an iterator over all the nodes contained in the graph for the specified composite.java.util.Iterator
nodesAfterEdges(java.lang.Object composite)
Return an iterator over the nodes that should be rendered after to the edges.java.util.Iterator
nodesBeforeEdges(java.lang.Object composite)
Return an iterator over the nodes that should be rendered prior to the edges.
-
-
-
Method Detail
-
getNodeCount
public int getNodeCount(java.lang.Object composite)
Return the number of nodes contained in the graph for the specified composite. If the argument is not an instance of CompositeEntity, then return 0.- Specified by:
getNodeCount
in interfaceCompositeModel
- Parameters:
composite
- A composite entity.- Returns:
- The number of nodes in the graph representing the specified composite entity.
-
nodes
public java.util.Iterator nodes(java.lang.Object composite)
Return an iterator over all the nodes contained in the graph for the specified composite. If the argument is not an instance of CompositeEntity, then return an empty iterator.- Specified by:
nodes
in interfaceCompositeModel
- Parameters:
composite
- A composite entity.- Returns:
- An iterator over nodes in the graph representing the specified composite entity.
-
nodesBeforeEdges
public java.util.Iterator nodesBeforeEdges(java.lang.Object composite)
Return an iterator over the nodes that should be rendered prior to the edges. This iterator does not necessarily support removal operations.- Specified by:
nodesBeforeEdges
in interfaceCompositeModel
- Parameters:
composite
- The composite.- Returns:
- An iterator over the nodes to be rendered prior to the edges.
-
nodesAfterEdges
public java.util.Iterator nodesAfterEdges(java.lang.Object composite)
Return an iterator over the nodes that should be rendered after to the edges. This iterator does not necessarily support removal operations.- Specified by:
nodesAfterEdges
in interfaceCompositeModel
- Parameters:
composite
- The composite.- Returns:
- An iterator over the nodes to be rendered after to the edges.
-
_getLocation
protected Locatable _getLocation(NamedObj object)
Return the location attribute contained in the given object, or a new location contained in the given object if there was no location.- Parameters:
object
- The object for which a location is needed.- Returns:
- The location of the object, or a new location if none.
-
-