|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.cobertura.reporting.ComplexityCalculator
Allows complexity computing for source files, packages and a whole project. Average McCabe's number for methods contained in the specified entity is returned. This class depends on FileFinder which is used to map source file names to existing files.
One instance of this class should be used for the same set of source files - an object of this class can cache computed results.
Nested Class Summary | |
private static class |
ComplexityCalculator.Complexity
Represents complexity of source file, package or project. |
Field Summary | |
private FileFinder |
finder
|
private static org.apache.log4j.Logger |
logger
|
private java.util.Map |
packageCNNCache
|
private java.util.Map |
sourceFileCNNCache
|
static ComplexityCalculator.Complexity |
ZERO_COMPLEXITY
|
Constructor Summary | |
ComplexityCalculator(FileFinder finder)
Creates new calculator. |
Method Summary | |
private ComplexityCalculator.Complexity |
getAccumlatedCCNForSingleFile(java.io.File file)
Calculates the code complexity number for single source file. |
double |
getCCNForClass(ClassData classData)
Computes CCN for source file the specified class belongs to. |
double |
getCCNForPackage(PackageData packageData)
Computes CCN for all sources contained in the specified package. |
private ComplexityCalculator.Complexity |
getCCNForPackageInternal(PackageData packageData)
|
double |
getCCNForProject(ProjectData projectData)
Computes CCN for all sources contained in the project. |
double |
getCCNForSourceFile(SourceFileData sourceFile)
Computes CCN for single source file. |
private ComplexityCalculator.Complexity |
getCCNForSourceFileNameInternal(java.lang.String sourceFileName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.log4j.Logger logger
public static final ComplexityCalculator.Complexity ZERO_COMPLEXITY
private final FileFinder finder
private java.util.Map sourceFileCNNCache
private java.util.Map packageCNNCache
Constructor Detail |
public ComplexityCalculator(FileFinder finder)
FileFinder
will be used to
map source file names to existing files when needed.
finder
- FileFinder
that allows to find source files
java.lang.NullPointerException
- if finder is nullMethod Detail |
private ComplexityCalculator.Complexity getAccumlatedCCNForSingleFile(java.io.File file)
file
- The source file for which you want to calculate
the complexity
public double getCCNForProject(ProjectData projectData)
projectData
- project to compute CCN for
java.lang.NullPointerException
- if projectData is nullpublic double getCCNForPackage(PackageData packageData)
packageData
- package to compute CCN for
java.lang.NullPointerException
- if packageData
is null
private ComplexityCalculator.Complexity getCCNForPackageInternal(PackageData packageData)
public double getCCNForSourceFile(SourceFileData sourceFile)
sourceFile
- source file to compute CCN for
sourceFile
to existing file
java.lang.NullPointerException
- if sourceFile
is null
private ComplexityCalculator.Complexity getCCNForSourceFileNameInternal(java.lang.String sourceFileName)
public double getCCNForClass(ClassData classData)
classData
- package to compute CCN for
java.lang.NullPointerException
- if classData
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |