Package ptolemy.graph.analysis.strategy
Class SinkNodeStrategy
- java.lang.Object
-
- ptolemy.graph.analysis.strategy.CachedStrategy
-
- ptolemy.graph.analysis.strategy.SinkNodeStrategy
-
- All Implemented Interfaces:
Analyzer
,GraphAnalyzer
,SinkNodeAnalyzer
public class SinkNodeStrategy extends CachedStrategy implements SinkNodeAnalyzer
Computation of sink nodes in a graph. The collection returned cannot be modified.This analysis requires O(N) time, where N is the number of nodes in the graph.
- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Ming Yung Ko, Shahrooz Shahparnia
- See Also:
SinkNodeAnalysis
- Pt.AcceptedRating:
- Red (ssb)
- Pt.ProposedRating:
- Red (ssb)
-
-
Constructor Summary
Constructors Constructor Description SinkNodeStrategy(Graph graph)
Construct a sink node analysis for a given graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
_compute()
Compute the sink nodes in the graph in the form of a collection.protected java.lang.Object
_convertResult()
Return the result of this analysis (collection of sink nodes) in a form that cannot be modified.java.util.List
nodes()
Compute the sink nodes in the graph in the form of a collection.java.lang.String
toString()
Return a description of sink nodes.boolean
valid()
Check compatibility of the class of graph.-
Methods inherited from class ptolemy.graph.analysis.strategy.CachedStrategy
_convertResult, _result, cachingStatus, disableCaching, enableCaching, getCachedResult, graph, obsolete, reset, setCachedResult
-
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
-
SinkNodeStrategy
public SinkNodeStrategy(Graph graph)
Construct a sink node analysis for a given graph.- Parameters:
graph
- The given graph.
-
-
Method Detail
-
nodes
public java.util.List nodes()
Compute the sink nodes in the graph in the form of a collection. Each element of the collection is aNode
.- Specified by:
nodes
in interfaceSinkNodeAnalyzer
- Returns:
- The sink nodes.
-
toString
public java.lang.String toString()
Return a description of sink nodes.- Specified by:
toString
in interfaceAnalyzer
- Overrides:
toString
in classCachedStrategy
- Returns:
- A description of the sink nodes.
-
valid
public boolean valid()
Check compatibility of the class of graph. The given graph must be an instance of DirectedGraph.
-
_compute
protected java.lang.Object _compute()
Compute the sink nodes in the graph in the form of a collection. Each element of the collection is aNode
.- Overrides:
_compute
in classCachedStrategy
- Returns:
- The sink nodes.
-
_convertResult
protected java.lang.Object _convertResult()
Return the result of this analysis (collection of sink nodes) in a form that cannot be modified.- Returns:
- The analysis result in unmodifiable form.
-
-