net.sourceforge.cobertura.reporting
Class Util

java.lang.Object
  extended bynet.sourceforge.cobertura.reporting.Util

public abstract class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static double getCCN(java.io.File file, boolean recursive)
          Calculates the code complexity number for a given class.
private static java.util.Vector getListOfFiles(java.io.File file, boolean recursive)
          Create a Vector containing the file names of Java source code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getCCN

public static double getCCN(java.io.File file,
                            boolean recursive)
Calculates the code complexity number for a given class. "CCN" stands for "code complexity number." This is sometimes referred to as McCabe's number. This method calculates the average cyclomatic code complexity of all methods in a given class, or of all methods of all classes in a given directory. This recursive calculation is useful for calculating the average CCN for a specific package.

Parameters:
file - The source of a Java class for which you want to calculate the complexity, or a directory containing Java source files for which you want to calculate the complexity.
recursive - If file is a directory, this parameter is used to decide whether to only list the files in the given directory, or to list all files in all subdirectories of the given directory.
Returns:
The average cyclomatic code complexity for this class.

getListOfFiles

private static java.util.Vector getListOfFiles(java.io.File file,
                                               boolean recursive)
Create a Vector containing the file names of Java source code. If the given file parameter is a regular file, then the return value only contains the absolute path of this file. However, if the given file parameter is a directory, this vector contains absolute paths to all files under this directory and all subdirectories.

Parameters:
file - A Java source file or a directory containing Java source files.
Returns:
A Vector containing Strings that are absolute paths to Java source files.