|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.actor.GraphReader
public class GraphReader
This class provides methods for converting Ptolemy II models into generic graph representations. Portions of this code are based on examples from [1].
References
[1] J. Davis et al., Heterogeneous
concurrent modeling and design in Java, Technical report,
Electronics Research Laboratory, University of California at Berkeley,
March 2001.
| Red (cxh) |
| Red (cxh) |
| Field Summary | |
|---|---|
private java.util.HashMap |
_actorMap
|
private static boolean |
_debug
|
| Constructor Summary | |
|---|---|
GraphReader()
Construct a new graph reader. |
|
| Method Summary | |
|---|---|
protected java.lang.Object |
_computeEdgeWeight(IOPort sourcePort,
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(Actor actor)
Determine the weight to be assigned to the weighted graph node that represents a given actor. |
protected Graph |
_initializeGraph(CompositeActor compositeActor)
Instantiate and initialize a graph just prior to filling it in from a given Ptolemy II model. |
protected void |
_processNewEdge(Graph graph,
Edge edge,
IOPort sourcePort,
IOPort sinkPort)
Process a new edge corresponding to a given connection in a given graph. |
protected void |
_processNewNode(Graph graph,
Node node,
Actor actor)
Process a new node corresponding to a given actor in a given graph. |
protected void |
_transformTopology(Graph graph)
Perform post-processing on the entire graph to complete the conversion. |
Graph |
convert(CompositeActor compositeActor)
Convert the model represented by a CompositeActor into a directed, weighted graph. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final boolean _debug
private java.util.HashMap _actorMap
| Constructor Detail |
|---|
public GraphReader()
| Method Detail |
|---|
public Graph convert(CompositeActor compositeActor)
_computeNodeWeight(Actor) and
_computeEdgeWeight(IOPort sourcePort,
IOPort sinkPort)
methods.
This method will convert low level CompositeActor as a node.
compositeActor - The composite actor to convert.
java.lang.RuntimeException - If the deep entity list of the
composite actor contains an entry that is not an AtomicActor.
protected java.lang.Object _computeEdgeWeight(IOPort sourcePort,
IOPort sinkPort)
sourcePort - the output port of the connection associated with
the edge.sinkPort - the input port of the connection associated with the
edge
protected java.lang.Object _computeNodeWeight(Actor actor)
actor - the actor whose node weight is to be determined.
protected Graph _initializeGraph(CompositeActor compositeActor)
compositeActor - the Ptolemy II model that will be converted.
protected void _processNewEdge(Graph graph,
Edge edge,
IOPort sourcePort,
IOPort sinkPort)
graph - The graph that contains the new edge.edge - The new edge.sourcePort - The source port of the connection in the model.sinkPort - The sink port of the connection.
protected void _processNewNode(Graph graph,
Node node,
Actor actor)
graph - The graph that contains the new node.node - The new node.actor - The actor that corresponds to the new node.protected void _transformTopology(Graph graph)
graph - the graph.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||