ptolemy.graph.analysis.strategy
Class SinkNodeStrategy

java.lang.Object
  extended by ptolemy.graph.analysis.strategy.Strategy
      extended by ptolemy.graph.analysis.strategy.CachedStrategy
          extended by 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: SinkNodeStrategy.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Ming Yung Ko, Shahrooz Shahparnia
See Also:
SinkNodeAnalysis
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (ssb)

Constructor Summary
SinkNodeStrategy(Graph graph)
          Construct a sink node analysis for a given graph.
 
Method Summary
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 a Node.

Specified by:
nodes in interface SinkNodeAnalyzer
Returns:
The sink nodes.

toString

public java.lang.String toString()
Return a description of sink nodes.

Specified by:
toString in interface Analyzer
Overrides:
toString in class CachedStrategy
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.

Specified by:
valid in interface Analyzer
Returns:
True if the given graph is of class 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 a Node.

Overrides:
_compute in class CachedStrategy
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.