net.sourceforge.cobertura.reporting
public class ComplexityCalculator extends Object
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 | |
|---|---|
| static class | ComplexityCalculator.Complexity
Represents complexity of source file, package or project. |
| Field Summary | |
|---|---|
| FileFinder | finder |
| static Logger | logger |
| Map | packageCNNCache |
| Map | sourceFileCNNCache |
| static ComplexityCalculator.Complexity | ZERO_COMPLEXITY |
| Constructor Summary | |
|---|---|
| ComplexityCalculator(FileFinder finder)
Creates new calculator. | |
| Method Summary | |
|---|---|
| ComplexityCalculator.Complexity | getAccumlatedCCNForSingleFile(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.
|
| 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.
|
| ComplexityCalculator.Complexity | getCCNForSourceFileNameInternal(String sourceFileName) |
Parameters: finder FileFinder that allows to find source files
Throws: NullPointerException if finder is null
Parameters: file The source file for which you want to calculate the complexity
Returns: average complexity for the specified source file
Parameters: classData package to compute CCN for
Returns: CCN for source file the specified class belongs to
Throws: NullPointerException if classData is null
Parameters: packageData package to compute CCN for
Returns: CCN for the specified package or 0 if no source files were found
Throws: NullPointerException if packageData is null
Parameters: projectData project to compute CCN for
Returns: CCN for project or 0 if no source files were found
Throws: NullPointerException if projectData is null
Parameters: sourceFile source file to compute CCN for
Returns: CCN for the specified source file, 0 if cannot map sourceFile to existing file
Throws: NullPointerException if sourceFile is null