ptolemy.vergil.kernel
Class CompositePtolemyModel

java.lang.Object
  extended byptolemy.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: CompositePtolemyModel.java,v 1.11.2.1 2004/06/18 00:49:30 cxh Exp $
Author:
Steve Neuendorffer and Edward A. Lee
See Also:
Location
Accepted Rating:
Red (johnr)
Proposed Rating:
Yellow (neuendor)

Constructor Summary
CompositePtolemyModel()
           
 
Method Summary
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.
protected  java.util.List _nodeList(NamedObj composite)
          Return a list of all the nodes in the graph corresponding to the specified Ptolemy II model.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositePtolemyModel

public CompositePtolemyModel()
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 interface CompositeModel
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 interface CompositeModel
Parameters:
composite - A composite entity.
Returns:
An iterator over nodes in the graph representing the specified composite entity.

_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.

_nodeList

protected java.util.List _nodeList(NamedObj composite)
Return a list of all the nodes in the graph corresponding to the specified Ptolemy II model. The model can be any NamedObj, and the returned list will include any entities, ports, relations, and attributes that it contains, in that order. Note that this method creates a new list, and should therefore only be called if the object has changed.

Parameters:
composite - The composite entity.
Returns:
A list of the nodes in the graph.