Package ptolemy.graph.analysis.strategy
Class ClusterNodesTransformerStrategy
- java.lang.Object
-
- ptolemy.graph.analysis.strategy.CachedStrategy
-
- ptolemy.graph.analysis.strategy.ClusterNodesTransformerStrategy
-
- All Implemented Interfaces:
Analyzer
,ClusterNodesTransformer
,GraphAnalyzer
,Transformer
public class ClusterNodesTransformerStrategy extends CachedStrategy implements ClusterNodesTransformer
Strategy for cluster transformers for graphs. The nodes of a graph given in a collection are being removed (clustered) and all of them are replaced by a single node called super node.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Shahrooz Shahparnia based on a method by Ming Yung Ko.
- See Also:
ClusterNodesAnalysis
- Pt.AcceptedRating:
- Red (ssb)
- Pt.ProposedRating:
- Red (shahrooz)
-
-
Constructor Summary
Constructors Constructor Description ClusterNodesTransformerStrategy(Graph graph, java.util.Collection nodeCollection, Node superNode)
Construct a clusterer for a given graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
_compute()
The computation associated with this strategy.Graph
clusterNodes()
Return the clustered Graph.boolean
hasBackwardMapping()
Specify if this transformation has a mapping from the transformed version to the original version or not.boolean
hasForwardMapping()
Specify if this transformation has a mapping from the original version to the transformed version or not.java.lang.Object
originalVersionOf(java.lang.Object dummy)
Unsupported operation.java.lang.Object
transformedVersionOf(java.lang.Object dummy)
Unsupported operation.boolean
valid()
Always valid.-
Methods inherited from class ptolemy.graph.analysis.strategy.CachedStrategy
_convertResult, _result, cachingStatus, disableCaching, enableCaching, getCachedResult, graph, obsolete, reset, setCachedResult, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.graph.analysis.analyzer.GraphAnalyzer
graph
-
-
-
-
Constructor Detail
-
ClusterNodesTransformerStrategy
public ClusterNodesTransformerStrategy(Graph graph, java.util.Collection nodeCollection, Node superNode)
Construct a clusterer for a given graph.- Parameters:
graph
- The given graph.nodeCollection
- The collection of nodes to be clustered.superNode
- The super node that replaces the clustered nodes.
-
-
Method Detail
-
clusterNodes
public Graph clusterNodes()
Return the clustered Graph.- Specified by:
clusterNodes
in interfaceClusterNodesTransformer
- Returns:
- Return the clustered Graph.
-
hasBackwardMapping
public boolean hasBackwardMapping()
Specify if this transformation has a mapping from the transformed version to the original version or not. This implementation does not.- Specified by:
hasBackwardMapping
in interfaceTransformer
- Returns:
- True If the implementation of the transformer supports backward mapping.
-
hasForwardMapping
public boolean hasForwardMapping()
Specify if this transformation has a mapping from the original version to the transformed version or not. This implementation does not.- Specified by:
hasForwardMapping
in interfaceTransformer
- Returns:
- True If the implementation of the transformer supports forward mapping.
-
originalVersionOf
public java.lang.Object originalVersionOf(java.lang.Object dummy)
Unsupported operation.- Specified by:
originalVersionOf
in interfaceTransformer
- Parameters:
dummy
- The given object in the transformed graph.- Returns:
- Return the original version the given object.
- Throws:
java.lang.UnsupportedOperationException
- If this method is called in any case.
-
transformedVersionOf
public java.lang.Object transformedVersionOf(java.lang.Object dummy)
Unsupported operation.- Specified by:
transformedVersionOf
in interfaceTransformer
- Parameters:
dummy
- The given object in the original graph.- Returns:
- Return the transformed version of the given object.
- Throws:
java.lang.UnsupportedOperationException
- If this method is called in any case.
-
valid
public boolean valid()
Always valid.
-
_compute
protected java.lang.Object _compute()
The computation associated with this strategy.- Overrides:
_compute
in classCachedStrategy
- Returns:
- The mirror graph as an
Object
.
-
-