JavaNCSS Metric Results

[ package ] [ object ] [ method ] [ explanation ]

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

Packages

[ package ] [ object ] [ method ] [ explanation ]

Packages sorted by NCSS.

PackageClassesMethodsNCSSJavadocsJavadoc linesSingle lines commentMulti lines comment
net.sf.openv4j16865256434452460
net.sf.openv4j.protocolhandlers6685024929813252
Classes totalMethods totalNCSS totalJavadocsJavadoc linesSingle lines commentMulti lines comment
22154102711364265712

Objects

[ package ] [ object ] [ method ] [ explanation ]

TOP 30 classes containing the most NCSS.

ObjectNCSSMethodsClassesJavadocs
net.sf.openv4j.DataPoint34535022
net.sf.openv4j.protocolhandlers.ProtocolHandler191828
net.sf.openv4j.protocolhandlers.MemoryImage10722022
net.sf.openv4j.protocolhandlers.SegmentedDataContainer661205
net.sf.openv4j.protocolhandlers.DataBlock42903
net.sf.openv4j.protocolhandlers.SimpleDataContainer33902
net.sf.openv4j.protocolhandlers.DataContainer28809
net.sf.openv4j.Holiday23909
net.sf.openv4j.CycleTimeEntry19607
net.sf.openv4j.Devices17600
net.sf.openv4j.CycleTimes17404
net.sf.openv4j.ErrorListEntry16606
net.sf.openv4j.GroupAndNameComparator11202
net.sf.openv4j.PropertyType9402
net.sf.openv4j.Group9402
net.sf.openv4j.Property9402
net.sf.openv4j.DataType5201
net.sf.openv4j.Protocol5202
net.sf.openv4j.AlsoAt2102
net.sf.openv4j.GwgAddress2102
net.sf.openv4j.Alternative1001
net.sf.openv4j.AccessType1000

TOP 30 classes containing the most methods.

ObjectNCSSMethodsClassesJavadocs
net.sf.openv4j.DataPoint34535022
net.sf.openv4j.protocolhandlers.MemoryImage10722022
net.sf.openv4j.protocolhandlers.SegmentedDataContainer661205
net.sf.openv4j.protocolhandlers.SimpleDataContainer33902
net.sf.openv4j.protocolhandlers.DataBlock42903
net.sf.openv4j.Holiday23909
net.sf.openv4j.protocolhandlers.DataContainer28809
net.sf.openv4j.protocolhandlers.ProtocolHandler191828
net.sf.openv4j.Devices17600
net.sf.openv4j.CycleTimeEntry19607
net.sf.openv4j.ErrorListEntry16606
net.sf.openv4j.CycleTimes17404
net.sf.openv4j.PropertyType9402
net.sf.openv4j.Group9402
net.sf.openv4j.Property9402
net.sf.openv4j.DataType5201
net.sf.openv4j.Protocol5202
net.sf.openv4j.GroupAndNameComparator11202
net.sf.openv4j.AlsoAt2102
net.sf.openv4j.GwgAddress2102
net.sf.openv4j.Alternative1001
net.sf.openv4j.AccessType1000

Averages.

NCSS averageProgram NCSSClasses averageMethods averageJavadocs average
43.551,027.000.097.005.14

Methods

[ package ] [ object ] [ method ] [ explanation ]

TOP 30 Methods containing the most NCSS.

MethodsNCSSCCNJavadocs
net.sf.openv4j.DataPoint.decode(MemoryImage)46381
net.sf.openv4j.protocolhandlers.ProtocolHandler.StreamListener.run()43200
net.sf.openv4j.DataPoint.getFormatString()33250
net.sf.openv4j.DataPoint.toString(MemoryImage,StringBuilder)27141
net.sf.openv4j.DataPoint.encode(MemoryImage,Object)27121
net.sf.openv4j.DataPoint.encodeDouble(MemoryImage,double)2280
net.sf.openv4j.DataPoint.printAddresses(StringBuilder,MemoryImage)1881
net.sf.openv4j.protocolhandlers.ProtocolHandler.StreamListener.checkConnBroken(int,State)1760
net.sf.openv4j.protocolhandlers.ProtocolHandler.StreamListener.dataWritten(int)1750
net.sf.openv4j.DataPoint.encodeByte(MemoryImage,byte)1660
net.sf.openv4j.protocolhandlers.ProtocolHandler.StreamListener.dataReaded(int)1660
net.sf.openv4j.DataPoint.encodeShort(MemoryImage,short)1570
net.sf.openv4j.DataPoint.printMatchingAddesses(DataPoint,MemoryImage,StringBuilder)1461
net.sf.openv4j.DataPoint.encodeInteger(MemoryImage,int)1480
net.sf.openv4j.protocolhandlers.MemoryImage.getCycleTimes(int,int)1231
net.sf.openv4j.protocolhandlers.DataBlock.writeTo(StringBuilder,boolean)1250
net.sf.openv4j.protocolhandlers.DataContainer.addMemoryImageLine(String)1151
net.sf.openv4j.protocolhandlers.ProtocolHandler.openPort(String)1111
net.sf.openv4j.protocolhandlers.MemoryImage.getTimeStamp_8(int)1011
net.sf.openv4j.protocolhandlers.SegmentedDataContainer.getNextSegmentAddr(int)1081
net.sf.openv4j.CycleTimes.toString()930
net.sf.openv4j.DataPoint.compareBytes(MemoryImage,int,int,int)970
net.sf.openv4j.DataPoint.DataPoint(int,Group,PropertyType,Property,DataType,AccessType)910
net.sf.openv4j.DataPoint.DataPoint(int,Group,PropertyType,Property,DataType,AccessType,Alternative)910
net.sf.openv4j.DataPoint.DataPoint(int,Group,PropertyType,Property,DataType,AccessType,double)910
net.sf.openv4j.DataPoint.DataPoint(int,Group,PropertyType,Property,DataType,AccessType,double,Alternative)910
net.sf.openv4j.protocolhandlers.MemoryImage.getHoliday(int)911
net.sf.openv4j.protocolhandlers.ProtocolHandler.StreamListener.sendWriteKWDataPackage(int,byte[])920
net.sf.openv4j.GroupAndNameComparator.compare(DataPoint,DataPoint)950
net.sf.openv4j.DataPoint.printAll(StringBuilder,DataContainer)841

Averages.

Program NCSSNCSS averageCCN averageJavadocs average
1,027.005.422.570.60

Explanations

[ package ] [ object ] [ method ] [ 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.

Examples
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 {
Label declarationfine :

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 will not be counted.

Note that 'else', 'default', and 'finally' don't increment the CCN value any further. On the other hand, a simple method with a 'switch' statement and a huge block of 'case' statements can have a surprisingly high CCN value (still it has the same value when converting a 'switch' block to an equivalent sequence of 'if' statements).