mapss.dif.graph
Class DFSAllTopSortsStrategy

java.lang.Object
  extended by mocgraph.analysis.strategy.CachedStrategy
      extended by mapss.dif.graph.DFSAllTopSortsStrategy
All Implemented Interfaces:
AllTopSortsAnalyzer, mocgraph.analysis.analyzer.Analyzer, mocgraph.analysis.analyzer.GraphAnalyzer

public class DFSAllTopSortsStrategy
extends mocgraph.analysis.strategy.CachedStrategy
implements AllTopSortsAnalyzer

A depth-first-search approach for finding all topological sorting orders.

Version:
$Id: DFSAllTopSortsStrategy.java 409 2007-05-13 19:47:16Z plishker $
Author:
Ming-Yung Ko
See Also:
AllTopSortsAnalysis

Constructor Summary
DFSAllTopSortsStrategy(mocgraph.Graph graph)
          Constructor with an input graph.
 
Method Summary
protected  java.lang.Object _compute()
          Compute all topological sorting orders.
 java.util.Collection topSorts()
          Return the collection of all topological sorting orders.
 java.lang.String toString()
          Return a description of the analysis in finding all top sorting orders.
 boolean valid()
          Check compatibility of the class of graph.
 
Methods inherited from class mocgraph.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 mocgraph.analysis.analyzer.GraphAnalyzer
graph
 

Constructor Detail

DFSAllTopSortsStrategy

public DFSAllTopSortsStrategy(mocgraph.Graph graph)
Constructor with an input graph.

Parameters:
graph - The given graph.
Method Detail

toString

public java.lang.String toString()
Return a description of the analysis in finding all top sorting orders.

Specified by:
toString in interface mocgraph.analysis.analyzer.Analyzer
Overrides:
toString in class mocgraph.analysis.strategy.CachedStrategy
Returns:
A description of the analysis.

topSorts

public java.util.Collection topSorts()
Return the collection of all topological sorting orders. Each element is an order in List.

Specified by:
topSorts in interface AllTopSortsAnalyzer
Returns:
The collection of topological sorting orders.

valid

public boolean valid()
Check compatibility of the class of graph. The given graph must be an instance of DirectedGraph and have acyclic structure.

Specified by:
valid in interface mocgraph.analysis.analyzer.Analyzer
Returns:
True if the given graph is a directed acyclic graph (DAG).

_compute

protected java.lang.Object _compute()
Compute all topological sorting orders. The result is returned as a Collection, where each element is a topological sorting order in List.

Overrides:
_compute in class mocgraph.analysis.strategy.CachedStrategy
Returns:
All topological sorting orders.