Class Analysis
- java.lang.Object
-
- ptolemy.graph.analysis.Analysis
-
- Direct Known Subclasses:
AllPairShortestPathAnalysis
,ClusterNodesAnalysis
,CycleExistenceAnalysis
,CycleMeanAnalysis
,MaximumProfitToCostRatioAnalysis
,MirrorTransformation
,NegativeLengthCycleAnalysis
,ScheduleAnalysis
,SelfLoopAnalysis
,SingleSourceLongestPathAnalysis
,SinkNodeAnalysis
,SourceNodeAnalysis
,TransitiveClosureAnalysis
,ZeroLengthCycleAnalysis
public class Analysis extends java.lang.Object
A base class for analyses on graphs.The organization of the package follows:
Classes in ptolemy.graph.analysis consists of different wrappers in which a client can plug a requested strategy/algorithm for an analysis. Strategies for a given analysis implement the same interface defined in ptolemy.graph.analysis.analyzer. Therefore from now on we will use the name analyzer for all the strategies that implement the same interface and therefore solve the same problem. Analysis classes access the plugged-in strategy class through these interfaces.
In the base class methods are provided in order to dynamically change the analyzer of the current analysis and also to check if a given analyzer is applicable to the given analysis.
Analyzers that can be used in these analyses are a specialized version of analyzers called
GraphAnalyzer
.Classes in ptolemy.graph.analysis.analyzer are the interfaces for different strategies(algorithms) used for the analysis. The strategies classes are defined in ptolemy.graph.analysis.strategy
In addition, the analysis classes provide default constructors which use predefined strategies for those clients who do not want to deal with different strategies. Although this introduces some limitations imposed by the used strategy. The documentation of such constructor will reflect the limitations, if any.
Finally, strategies can be instantiated and used independently. In this case the client will lose the possibility of dynamically changing the analyzer for the associated analysis, which would not exist at all, and there will be no default constructor therefore the client need to be familiar with the strategy that she/he is using.
- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Shahrooz Shahparnia, Shuvra S. Bhattacharyya
- Pt.AcceptedRating:
- Red (ssb)
- Pt.ProposedRating:
- Red (shahrooz)
-
-
Constructor Summary
Constructors Constructor Description Analysis(GraphAnalyzer analyzer)
Construct an analysis using a given analyzer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphAnalyzer
analyzer()
Return the analyzer associated with this analysis class.void
changeAnalyzer(GraphAnalyzer analyzer)
Change the analyzer associated with this analysis class to the given analyzer.Graph
graph()
The graph associated with the analysis.java.lang.String
toString()
Return a description of the analysis and the associated analyzer.boolean
valid()
Return the validity of the associated analyzer.boolean
validAnalyzerInterface(Analyzer analyzer)
Check if a given analyzer is compatible with this analysis.
-
-
-
Constructor Detail
-
Analysis
public Analysis(GraphAnalyzer analyzer)
Construct an analysis using a given analyzer.- Parameters:
analyzer
- The given analyzer.
-
-
Method Detail
-
analyzer
public GraphAnalyzer analyzer()
Return the analyzer associated with this analysis class.- Returns:
- Return the analyzer associated with this analysis class.
-
changeAnalyzer
public void changeAnalyzer(GraphAnalyzer analyzer)
Change the analyzer associated with this analysis class to the given analyzer.- Parameters:
analyzer
- The given analyzer.- Throws:
InvalidAnalyzerException
- If the analyzer is not a valid analyzer for this analysis.
-
graph
public Graph graph()
The graph associated with the analysis. This association is made through the associated analyzer interface.- Returns:
- Return the graph under analysis.
-
toString
public java.lang.String toString()
Return a description of the analysis and the associated analyzer. It should be overridden in derived classes to include details associated with the associated analysis/analyzer.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A description of the analysis and the associated analyzer.
-
valid
public boolean valid()
Return the validity of the associated analyzer. An analyzer is valid if the graph and the associated data is in a format suitable for the analyzer.- Returns:
- Return the validity of the associated analyzer.
-
validAnalyzerInterface
public boolean validAnalyzerInterface(Analyzer analyzer)
Check if a given analyzer is compatible with this analysis. In other words if it is possible to use it to compute the computation associated with this analysis. Derived classes should override this method to provide the valid type of analyzer that they need.- Parameters:
analyzer
- The given analyzer.- Returns:
- True if the given analyzer is valid for this analysis.
-
-