JavaNCSS Metric Results

[ package ] [ object ] [ function ] [ explanation ]

The following document contains the results of a JavaNCSS metric analysis.
JavaNCSS web site.

Packages

[ package ] [ object ] [ function ] [ explanation ]

Packages sorted by NCSS.

PackageClassesFunctionsNCSSJavadocsJavadoc linesSingle lines commentMulti lines comment
com.zmicer.utils13334754434536138
com.zmicer.utils.junit3142197626173
com.zmicer.utils.model.junit77331046012
com.zmicer.utils.model11421700
Classes totalFunctions totalNCSS totalJavadocsJavadoc linesSingle lines commentMulti lines comment
24557316347042323

Objects

[ package ] [ object ] [ function ] [ explanation ]

TOP 30 classes containing the most NCSS.

ObjectNCSSFunctionsClassesJavadocs
com.zmicer.utils.FileUtils118806
com.zmicer.utils.junit.ZmicerTestUtils114813
com.zmicer.utils.ResourceUtils77202
com.zmicer.utils.junit.JUnitUtils72502
com.zmicer.utils.ReflexionUtils49607
com.zmicer.utils.StringUtils36405
com.zmicer.utils.ClassPathUtils35404
com.zmicer.utils.InputArgumentUtils25203
com.zmicer.utils.ClassLoaderUtils23115
com.zmicer.utils.LoggingUtils15304
com.zmicer.utils.MagicNumbers11001
com.zmicer.utils.CollectionsUtils9102
com.zmicer.utils.model.junit.JustInterfaceImplThrowingExceptionInStaticInit7201
com.zmicer.utils.ObjectStateUtils7102
com.zmicer.utils.junit.SystemPropsUtils5102
com.zmicer.utils.model.junit.JustInterfaceImplThrowingExceptionInConstructor5201
com.zmicer.utils.REUtils5102
com.zmicer.utils.model.junit.JustInterfaceImpl13102
com.zmicer.utils.model.junit.JustInterfaceImpl23102
com.zmicer.utils.ZmicerUtilsConstants3011
com.zmicer.utils.model.ICheckable2102
com.zmicer.utils.model.junit.IJustInterface2102
com.zmicer.utils.model.junit.IJustInterface21001
com.zmicer.utils.model.junit.IJustInterface31001

TOP 30 classes containing the most functions.

ObjectNCSSFunctionsClassesJavadocs
com.zmicer.utils.FileUtils118806
com.zmicer.utils.junit.ZmicerTestUtils114813
com.zmicer.utils.ReflexionUtils49607
com.zmicer.utils.junit.JUnitUtils72502
com.zmicer.utils.ClassPathUtils35404
com.zmicer.utils.StringUtils36405
com.zmicer.utils.LoggingUtils15304
com.zmicer.utils.InputArgumentUtils25203
com.zmicer.utils.model.junit.JustInterfaceImplThrowingExceptionInConstructor5201
com.zmicer.utils.model.junit.JustInterfaceImplThrowingExceptionInStaticInit7201
com.zmicer.utils.ResourceUtils77202
com.zmicer.utils.ClassLoaderUtils23115
com.zmicer.utils.CollectionsUtils9102
com.zmicer.utils.junit.SystemPropsUtils5102
com.zmicer.utils.model.ICheckable2102
com.zmicer.utils.model.junit.IJustInterface2102
com.zmicer.utils.model.junit.JustInterfaceImpl13102
com.zmicer.utils.model.junit.JustInterfaceImpl23102
com.zmicer.utils.ObjectStateUtils7102
com.zmicer.utils.REUtils5102
com.zmicer.utils.MagicNumbers11001
com.zmicer.utils.model.junit.IJustInterface21001
com.zmicer.utils.model.junit.IJustInterface31001
com.zmicer.utils.ZmicerUtilsConstants3011
Averages.
NCSS averageProgram NCSSClasses averageFunctions averageJavadocs average
26.17731.000.132.292.63

Functions

[ package ] [ object ] [ function ] [ explanation ]

TOP 30 functions containing the most NCSS.

FunctionsNCSSCCNJavadocs
com.zmicer.utils.ResourceUtils.getResourceBundle(String)41191
com.zmicer.utils.ResourceUtils.getResource(String)34160
com.zmicer.utils.junit.ZmicerTestUtils.getFolderWithTestData(String)32150
com.zmicer.utils.junit.JUnitUtils.checkOnWrongArgs(Object,String,boolean[],Class[],Object)31140
com.zmicer.utils.FileUtils.findFilesByREInClassPath(List,Pattern)3090
com.zmicer.utils.junit.ZmicerTestUtils.getFolderWithTestData()24131
com.zmicer.utils.FileUtils.findFilesByRE(File,Pattern)2081
com.zmicer.utils.FileUtils.findFoldersByRE(File,Pattern)2080
com.zmicer.utils.InputArgumentUtils.checkObjects(Object)1791
com.zmicer.utils.ReflexionUtils.reflectObjects(Map,boolean)1681
com.zmicer.utils.junit.ZmicerTestUtils.getFullTestDataFolderName(Class,boolean,String,boolean)1590
com.zmicer.utils.junit.JUnitUtils.runFailure(Object,String,Class,Class[],Object)1440
com.zmicer.utils.FileUtils.getResourceBundleViaFile(String)1361
com.zmicer.utils.ClassPathUtils.getFileNames(List,boolean)1251
com.zmicer.utils.ClassPathUtils.getDirNames(List,boolean)1250
com.zmicer.utils.junit.JUnitUtils.getRunningTestMethodName()1140
com.zmicer.utils.StringUtils.split(String,String)1141
com.zmicer.utils.ClassLoaderUtils.retrieveActualClassLoaders()1031
com.zmicer.utils.junit.ZmicerTestUtils.getFullTestDataFileName(String,String)1050
com.zmicer.utils.junit.ZmicerTestUtils.getFullTestDataFileName(Class,boolean,String,String,boolean)1040
com.zmicer.utils.FileUtils.findFilesByRE(String,Pattern)931
com.zmicer.utils.FileUtils.findFoldersByRE(String,Pattern)930
com.zmicer.utils.ReflexionUtils.reflectObject(String,boolean)951
com.zmicer.utils.StringUtils.getBoolean(String)951
com.zmicer.utils.FileUtils.constructPath(String)831
com.zmicer.utils.junit.JUnitUtils.getTestMethodsNumber(Class)831
com.zmicer.utils.junit.ZmicerTestUtils.getFullTestDataFolderName(String)850
com.zmicer.utils.LoggingUtils.logException(Logger,Throwable,String,Class)831
com.zmicer.utils.ReflexionUtils.getBaseName(Class)851
com.zmicer.utils.ReflexionUtils.getClassNameOfArrayMembers(Class)841

Averages.

Program NCSSNCSS averageCCN averageJavadocs average
731.009.604.470.66

Explanations

[ package ] [ object ] [ function ] [ explanation ]

Non Commenting Source Statements (NCSS)

Statements for JavaNCSS are not statements as specified in the Java Language Specification but include all kinds of declarations too. Roughly spoken, NCSS is approximately equivalent to counting ';' and '{' characters in Java source files.

Not counted are empty statements, empty blocks or semicolons after closing brackets. Of course, comments don't get counted too. Closing brackets also never get counted, the same applies to blocks in general.

ExamplesComments
Package declarationpackage java.lang;
Import declarationimport java.awt.*;
Class declaration
  • public class Foo {
  • public class Foo extends Bla {
Interface declarationpublic interface Able ; {
Field declaration
  • int a;
  • int a, b, c = 5, d = 6;
Method declaration
  • public void cry();
  • public void gib() throws DeadException {
Constructor declarationpublic Foo() {
Constructor invocation
  • this();
  • super();
Statement declaration
  • i = 0;
  • if (ok)
  • if (exit) {
  • if (3 == 4);
  • if (4 == 4) { ;
  • } else {
expression, if, else, while, do, for, switch, break, continue, return, throw, synchronized, catch, finally
Label declarationfine :normal, case, default
In some cases consecutive semicolons are illegal according to the JLS but JavaNCSS still tolerates them (thought JavaNCSS is still more strict as 'javac'). Nevertheless they are never counted as two statements.Cyclomatic Complexity Number (CCN)CCN is also know as McCabe Metric. There exists a much hyped theory behind it based on graph theory, but it all comes down to simply counting 'if', 'for', 'while' statements etc. in a method. Whenever the control flow of a method splits, the "CCN counter" gets incremented by one.Each method has a minimum value of 1 per default. For each of the following Java keywords/statements this value gets incremented by one:
  • if
  • for
  • while
  • case
  • catch
Also if the control flow of a method returns abortively the CCNvalue will be incremented by one:
  • if
  • for
An ordinary return at the end of method (no matter if it's a function or a procedure) will not be counted.Note that else, default, and finallydon't increment the CCN value any further. On the other hand, a simple method with a switchstatement and a huge block of casestatements can have a surprisingly high CCN value (still it has the same value when converting a switchblock to an equivalent sequence of ifstatements).The first article about this trivial software metric is one of the most cited papers in computer science. Sometimes you just must be the first to point out some basic shit and you are history. It seems just like a wonder that nobody was able to package Lines of Code in a more scientific manner. Now it's too late to label someone's name on it :).