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.

Package Classes Methods NCSS Javadocs Javadoc lines Single lines comment Multi lines comment
net.miginfocom.layout 18 526 4401 425 2677 331 700
net.miginfocom.demo 5 122 3082 1 2 460 66
net.miginfocom.swing 3 83 519 25 122 52 112
net.miginfocom.swt 3 75 399 25 109 75 103
net.miginfocom.examples 5 12 148 4 17 10 0
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
34 818 8549 480 2927 928 981

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
net.miginfocom.demo.SwingDemo 1515 53 15 0
net.miginfocom.layout.Grid 1313 62 4 20
net.miginfocom.demo.SwtDemo 1116 49 7 0
net.miginfocom.layout.ConstraintParser 824 24 0 22
net.miginfocom.layout.IDEUtil 428 13 0 11
net.miginfocom.layout.CC 359 116 0 111
net.miginfocom.layout.UnitValue 290 31 1 8
net.miginfocom.swing.MigLayout 245 39 3 23
net.miginfocom.layout.PlatformDefaults 234 43 0 42
net.miginfocom.demo.HiDPISimulator 230 7 7 1
net.miginfocom.swing.SwingComponentWrapper 222 37 0 1
net.miginfocom.layout.LC 221 80 0 78
net.miginfocom.swt.MigLayout 191 30 1 21
net.miginfocom.layout.LayoutUtil 190 26 1 20
net.miginfocom.swt.SwtComponentWrapper 160 37 0 3
net.miginfocom.layout.AC 126 31 0 28
net.miginfocom.layout.DimConstraint 103 35 0 26
net.miginfocom.layout.LinkHandler 90 6 0 2
net.miginfocom.layout.BoundSize 87 16 1 13
net.miginfocom.demo.CallbackDemo 81 11 4 0
net.miginfocom.demo.HiDPIDemoPanel 78 2 2 0
net.miginfocom.layout.ComponentWrapper 49 28 0 29
net.miginfocom.examples.JavaOneShrink 35 3 1 1
net.miginfocom.swing.SwingContainerWrapper 28 7 0 1
net.miginfocom.examples.BugTestApp 26 3 1 1
net.miginfocom.examples.Example02 26 3 1 0
net.miginfocom.swt.SwtContainerWrapper 24 8 0 1
net.miginfocom.examples.Example01 21 2 1 1
net.miginfocom.layout.ResizeConstraint 19 5 0 1
net.miginfocom.examples.SwtTest 17 1 0 1

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
net.miginfocom.layout.CC 359 116 0 111
net.miginfocom.layout.LC 221 80 0 78
net.miginfocom.layout.Grid 1313 62 4 20
net.miginfocom.demo.SwingDemo 1515 53 15 0
net.miginfocom.demo.SwtDemo 1116 49 7 0
net.miginfocom.layout.PlatformDefaults 234 43 0 42
net.miginfocom.swing.MigLayout 245 39 3 23
net.miginfocom.swing.SwingComponentWrapper 222 37 0 1
net.miginfocom.swt.SwtComponentWrapper 160 37 0 3
net.miginfocom.layout.DimConstraint 103 35 0 26
net.miginfocom.layout.AC 126 31 0 28
net.miginfocom.layout.UnitValue 290 31 1 8
net.miginfocom.swt.MigLayout 191 30 1 21
net.miginfocom.layout.ComponentWrapper 49 28 0 29
net.miginfocom.layout.LayoutUtil 190 26 1 20
net.miginfocom.layout.ConstraintParser 824 24 0 22
net.miginfocom.layout.BoundSize 87 16 1 13
net.miginfocom.layout.IDEUtil 428 13 0 11
net.miginfocom.demo.CallbackDemo 81 11 4 0
net.miginfocom.swt.SwtContainerWrapper 24 8 0 1
net.miginfocom.demo.HiDPISimulator 230 7 7 1
net.miginfocom.swing.SwingContainerWrapper 28 7 0 1
net.miginfocom.layout.LinkHandler 90 6 0 2
net.miginfocom.layout.ContainerWrapper 6 5 0 6
net.miginfocom.layout.ResizeConstraint 19 5 0 1
net.miginfocom.examples.BugTestApp 26 3 1 1
net.miginfocom.examples.Example02 26 3 1 0
net.miginfocom.examples.JavaOneShrink 35 3 1 1
net.miginfocom.layout.LayoutCallback 6 3 0 4
net.miginfocom.demo.HiDPIDemoPanel 78 2 2 0

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
246.03 8,549.00 1.47 24.06 14.12

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
net.miginfocom.layout.ConstraintParser.parseComponentConstraint(String) 287 138 1
net.miginfocom.layout.Grid.Grid(ContainerWrapper,LC,AC,AC,Map,ArrayList) 202 110 1
net.miginfocom.layout.ConstraintParser.parseLayoutConstraint(String) 147 78 1
net.miginfocom.layout.IDEUtil.getConstraintString(CC,boolean) 123 82 1
net.miginfocom.demo.HiDPISimulator.createSimulator() 108 2 0
net.miginfocom.layout.IDEUtil.getConstraintString(LC,boolean) 105 64 1
net.miginfocom.layout.UnitValue.getPixelsExact(float,ContainerWrapper,ComponentWrapper) 87 89 1
net.miginfocom.demo.SwingDemo.SwingDemo() 86 8 0
net.miginfocom.demo.SwingDemo.createAbsolute_Position() 79 3 0
net.miginfocom.demo.SwingDemo.createGrouping() 74 1 0
net.miginfocom.layout.IDEUtil.addRowDimConstraintString(DimConstraint,StringBuffer,boolean) 73 36 1
net.miginfocom.demo.SwtDemo.createGrouping(Composite) 68 1 0
net.miginfocom.demo.SwtDemo.createDocking(Composite) 66 5 0
net.miginfocom.demo.SwingDemo.createDocking() 65 4 0
net.miginfocom.demo.SwingDemo.createLayout_Showdown() 62 1 0
net.miginfocom.demo.HiDPIDemoPanel.HiDPIDemoPanel() 61 1 0
net.miginfocom.layout.LayoutUtil.calculateSerial(int[][],ResizeConstraint[],Float[],int,int) 61 31 1
net.miginfocom.demo.SwtDemo.doBenchmark() 59 1 0
net.miginfocom.layout.Grid.sortCellsByPlatform(Collection,ContainerWrapper) 59 24 1
net.miginfocom.demo.SwtDemo.createLayout_Showdown(Composite) 57 1 0
net.miginfocom.layout.Grid.calcRowsOrColsSizes(boolean) 56 24 1
net.miginfocom.swing.SwingComponentWrapper.checkType(boolean) 56 45 0
net.miginfocom.demo.SwtDemo.Thread$3.run() 55 11 0
net.miginfocom.demo.SwingDemo.createGrowing() 54 1 0
net.miginfocom.layout.IDEUtil.addComponentDimConstraintString(DimConstraint,StringBuffer,boolean,boolean,boolean) 54 38 1
net.miginfocom.layout.Grid.layout(int[],UnitValue,UnitValue,boolean,boolean) 53 27 1
net.miginfocom.layout.ConstraintParser.parseDimConstraint(String,BoundSize,BoundSize,boolean) 52 17 1
net.miginfocom.layout.ConstraintParser.parseGaps(String) 52 24 1
net.miginfocom.layout.ConstraintParser.parseUnitValue(String,UnitValue,boolean) 50 34 1
net.miginfocom.layout.Grid.divideIntoLinkedGroups(boolean) 49 30 1

Averages.

Program NCSS NCSS average CCN average Javadocs average
8,549.00 9.18 3.60 0.49

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 declaration package java.lang;
Import declaration import java.awt.*;
Class declaration
  • public class Foo {
  • public class Foo extends Bla {
Interface declaration public interface Able ; {
Field declaration
  • int a;
  • int a, b, c = 5, d = 6;
Method declaration
  • public void cry();
  • public void gib() throws DeadException {
Constructor declaration public Foo() {
Constructor invocation
  • this();
  • super();
Statement declaration
  • i = 0;
  • if (ok)
  • if (exit) {
  • if (3 == 4);
  • if (4 == 4) { ;
  • } else {
Label declaration fine :

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).