ptolemy.graph.analysis.strategy
Class SelfLoopStrategy

java.lang.Object
  extended by ptolemy.graph.analysis.strategy.Strategy
      extended by ptolemy.graph.analysis.strategy.CachedStrategy
          extended by ptolemy.graph.analysis.strategy.SelfLoopStrategy
All Implemented Interfaces:
Analyzer, GraphAnalyzer, SelfLoopAnalyzer

public class SelfLoopStrategy
extends CachedStrategy
implements SelfLoopAnalyzer

Computation of self-loops in a graph. The returned collection cannot be modified.

This analysis requires O(E) time, where E is the number of edges in the graph.

Since:
Ptolemy II 4.0
Version:
$Id: SelfLoopStrategy.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Shuvra S. Bhattacharyya, Shahrooz Shahparnia
See Also:
SelfLoopAnalysis
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (ssb)

Constructor Summary
SelfLoopStrategy(Graph graph)
          Construct an instance of this strategy for a given graph.
 
Method Summary
protected  java.lang.Object _compute()
          Compute the self-loop edges in the graph in the form of a collection.
protected  java.lang.Object _convertResult()
          Return the result of this analysis (collection of self-loop edges) in a form that cannot be modified.
 java.util.List edges()
          Compute the self-loop edges in the graph in the form of a collection.
 java.lang.String toString()
          Return a description of the analyzer.
 boolean valid()
          Check for validity of this strategy.
 
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

SelfLoopStrategy

public SelfLoopStrategy(Graph graph)
Construct an instance of this strategy for a given graph.

Parameters:
graph - The given graph.
Method Detail

edges

public java.util.List edges()
Compute the self-loop edges in the graph in the form of a collection. Each element of the collection is an Edge.

Specified by:
edges in interface SelfLoopAnalyzer
Returns:
The self-loop edges.

toString

public java.lang.String toString()
Return a description of the analyzer.

Specified by:
toString in interface Analyzer
Overrides:
toString in class CachedStrategy
Returns:
Return a description of the analyzer..

valid

public boolean valid()
Check for validity of this strategy.

Specified by:
valid in interface Analyzer
Returns:
True since this strategy is always valid.

_compute

protected java.lang.Object _compute()
Compute the self-loop edges in the graph in the form of a collection. Each element of the collection is an Edge.

Overrides:
_compute in class CachedStrategy
Returns:
The self-loop edges.

_convertResult

protected java.lang.Object _convertResult()
Return the result of this analysis (collection of self-loop edges) in a form that cannot be modified.

Returns:
The analysis result in unmodifiable form.