net.sourceforge.cobertura.reporting
Class Util
java.lang.Object
net.sourceforge.cobertura.reporting.Util
public abstract class Util
extends java.lang.Object
static double | getCCN(File file, boolean recursive) - Calculates the code complexity number for a given class.
|
private static Vector | getListOfFiles(File file, boolean recursive) - Create a
Vector containing the file names of
Java source code.
|
logger
private static final Logger logger
getCCN
public static double getCCN(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.
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.
- The average cyclomatic code complexity for this class.
getListOfFiles
private static Vector getListOfFiles(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.
file
- A Java source file or a directory containing
Java source files.
- A Vector containing
String
s that
are absolute paths to Java source files.