mapss.dif.ptolemy
Class DIFGraphReader

java.lang.Object
  extended by mapss.dif.ptolemy.GraphReader
      extended by mapss.dif.ptolemy.DIFGraphReader
Direct Known Subclasses:
PSDFGraphReader, SDFGraphReader

public class DIFGraphReader
extends mapss.dif.ptolemy.GraphReader

Conversion of Ptolemy II models to DIFGraphs. This class provides methods for converting Ptolemy II models into DIFGraphs. All actors are deeply connected such that the hierarchical ptolemy application can be expressed by a single graph. For import and export of Ptolemy application, please see DIFGraphImporter and DIFGraphExporter.

Version:
$Id: DIFGraphReader.java 394 2007-04-23 22:28:04Z plishker $
Author:
Chia-Jui Hsu
See Also:
GraphReader

Constructor Summary
DIFGraphReader()
          Construct a new graph reader.
 
Method Summary
protected  java.lang.Object _computeEdgeWeight(ptolemy.actor.IOPort sourcePort, ptolemy.actor.IOPort sinkPort)
          Determine the weight to be assigned to the weighted graph edge that represents a given connection in a Ptolemy II model.
protected  java.lang.Object _computeNodeWeight(ptolemy.actor.Actor actor)
          Determine the weight to be assigned to the weighted graph node that represents a given actor.
protected  mocgraph.Graph _initializeGraph(ptolemy.actor.CompositeActor compositeActor)
          This method override the method in (ptolemy.actor.GraphReader).
protected  void _processNewEdge(mocgraph.Graph graph, mocgraph.Edge edge, ptolemy.actor.IOPort sourcePort, ptolemy.actor.IOPort sinkPort)
          Process a new edge that is added to the graph.
protected  void _processNewNode(mocgraph.Graph graph, mocgraph.Node node, ptolemy.actor.Actor actor)
          Process a new node that is added to the graph.
 
Methods inherited from class mapss.dif.ptolemy.GraphReader
_transformTopology, convert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DIFGraphReader

public DIFGraphReader()
Construct a new graph reader.

Method Detail

_computeEdgeWeight

protected java.lang.Object _computeEdgeWeight(ptolemy.actor.IOPort sourcePort,
                                              ptolemy.actor.IOPort sinkPort)
Determine the weight to be assigned to the weighted graph edge that represents a given connection in a Ptolemy II model.

Overrides:
_computeEdgeWeight in class mapss.dif.ptolemy.GraphReader
Parameters:
sourcePort - the output port of the connection associated with the edge.
sinkPort - the input port of the connection associated with the edge
Returns:
DIFEdgeWeight.

_computeNodeWeight

protected java.lang.Object _computeNodeWeight(ptolemy.actor.Actor actor)
Determine the weight to be assigned to the weighted graph node that represents a given actor.

Overrides:
_computeNodeWeight in class mapss.dif.ptolemy.GraphReader
Parameters:
actor - the actor whose node weight is to be determined.
Returns:
DIFNodeWeight.

_initializeGraph

protected mocgraph.Graph _initializeGraph(ptolemy.actor.CompositeActor compositeActor)
This method override the method in (ptolemy.actor.GraphReader).

Overrides:
_initializeGraph in class mapss.dif.ptolemy.GraphReader
Parameters:
compositeActor - the Ptolemy II model that will be converted.
Returns:
the empty DIFGraph that is to hold the converted model.

_processNewEdge

protected void _processNewEdge(mocgraph.Graph graph,
                               mocgraph.Edge edge,
                               ptolemy.actor.IOPort sourcePort,
                               ptolemy.actor.IOPort sinkPort)
Process a new edge that is added to the graph.

Overrides:
_processNewEdge in class mapss.dif.ptolemy.GraphReader
Parameters:
graph - The graph.
edge - The new edge.
sourcePort - The source port associated with the edge in the model.
sinkPort - The sink port associated with the edge in the model.

_processNewNode

protected void _processNewNode(mocgraph.Graph graph,
                               mocgraph.Node node,
                               ptolemy.actor.Actor actor)
Process a new node that is added to the graph.

Overrides:
_processNewNode in class mapss.dif.ptolemy.GraphReader
Parameters:
graph - The graph.
node - The new node.
actor - The actor that corresponds to the node in the model.