edu.cmu.cs.crystal
Class AbstractCrystalMethodAnalysis

java.lang.Object
  extended by edu.cmu.cs.crystal.AbstractCrystalMethodAnalysis
All Implemented Interfaces:
ICrystalAnalysis
Direct Known Subclasses:
ConstantAnalysis, LiveVariableAnalysis, MayAliasAnalysis, PrintNodesAnalysis, SimpleInstructionVisitor

public abstract class AbstractCrystalMethodAnalysis
extends Object
implements ICrystalAnalysis

An ICrystalAnalysis which runs on each method (and constructor) of the class.

Author:
David Dickey, Jonathan Aldrich

Constructor Summary
AbstractCrystalMethodAnalysis()
           
 
Method Summary
 void afterAllCompilationUnits()
          Inform the analysis that all compilation units have been analyzed.
 void afterAllMethods(ITypeRoot compUnit, CompilationUnit rootNode)
          This method is invoked once after all methods are analyzed.
abstract  void analyzeMethod(MethodDeclaration d)
          Invoked for each method or constructor in the class.
 void beforeAllCompilationUnits()
          Inform the analysis that the analysis process is about to begin.
 void beforeAllMethods(ITypeRoot compUnit, CompilationUnit rootNode)
          This method is invoked once before any methods are analyzed.
 IAnalysisInput getInput()
           
 String getName()
           
 IAnalysisReporter getReporter()
           
 void runAnalysis(IAnalysisReporter reporter, IAnalysisInput input, ITypeRoot compUnit, CompilationUnit rootNode)
          beforeAllMethods(org.eclipse.jdt.core.ITypeRoot, org.eclipse.jdt.core.dom.CompilationUnit) is run before any method is analyzed.
Then each method is analysed by analyzeMethod(MethodDeclaration).
Finally afterAllMethods(org.eclipse.jdt.core.ITypeRoot, org.eclipse.jdt.core.dom.CompilationUnit) is run after all methods have been analyzed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCrystalMethodAnalysis

public AbstractCrystalMethodAnalysis()
Method Detail

getName

public String getName()
Specified by:
getName in interface ICrystalAnalysis
Returns:
a unique name for this analysis. This name will be used by Crystal for menu items, error reporting, and otherwise identifying this analysis to the user.

runAnalysis

public final void runAnalysis(IAnalysisReporter reporter,
                              IAnalysisInput input,
                              ITypeRoot compUnit,
                              CompilationUnit rootNode)
beforeAllMethods(org.eclipse.jdt.core.ITypeRoot, org.eclipse.jdt.core.dom.CompilationUnit) is run before any method is analyzed.
Then each method is analysed by analyzeMethod(MethodDeclaration).
Finally afterAllMethods(org.eclipse.jdt.core.ITypeRoot, org.eclipse.jdt.core.dom.CompilationUnit) is run after all methods have been analyzed.

Specified by:
runAnalysis in interface ICrystalAnalysis
Parameters:
reporter - The object that is used to report errors. Output.
input - The input to this analysis.
compUnit - The compilation unit
rootNode - The root ASTNode of the compilation unit

afterAllCompilationUnits

public void afterAllCompilationUnits()
Description copied from interface: ICrystalAnalysis
Inform the analysis that all compilation units have been analyzed.

Specified by:
afterAllCompilationUnits in interface ICrystalAnalysis

beforeAllCompilationUnits

public void beforeAllCompilationUnits()
Description copied from interface: ICrystalAnalysis
Inform the analysis that the analysis process is about to begin.

Specified by:
beforeAllCompilationUnits in interface ICrystalAnalysis

getReporter

public IAnalysisReporter getReporter()
Specified by:
getReporter in interface ICrystalAnalysis
Returns:
the IAnalysisReporter that is being used for the current run of the analysis, or null if there is not currently an analysis being run.

getInput

public IAnalysisInput getInput()
Specified by:
getInput in interface ICrystalAnalysis
Returns:
the IAnalysisInput that is being used for the current run of the analysis, or null if there is not currently an analysis being run.

beforeAllMethods

public void beforeAllMethods(ITypeRoot compUnit,
                             CompilationUnit rootNode)
This method is invoked once before any methods are analyzed. It can be used to perform pre-analysis functionality, if needed.


analyzeMethod

public abstract void analyzeMethod(MethodDeclaration d)
Invoked for each method or constructor in the class.


afterAllMethods

public void afterAllMethods(ITypeRoot compUnit,
                            CompilationUnit rootNode)
This method is invoked once after all methods are analyzed. It can be used to perform post-analysis functionality, if needed.