JavaNCSS Metric Results

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

The following document contains the results of a JavaNCSS metric analysis, using JavaNCSS version 32.53.
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 25 586 4583 453 2863 342 764
net.miginfocom.demo 53 183 3120 2 7 461 135
net.miginfocom.swing 6 91 574 30 137 43 109
net.miginfocom.swt 5 81 414 28 120 48 103
net.miginfocom.examples 13 22 238 3 12 10 231
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
102 963 8929 516 3139 904 1342

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 1308 64 4 23
net.miginfocom.demo.SwtDemo 1123 50 7 0
net.miginfocom.layout.ConstraintParser 833 24 0 22
net.miginfocom.layout.CC 463 130 0 125
net.miginfocom.layout.IDEUtil 430 13 0 11
net.miginfocom.layout.UnitValue 291 31 1 8
net.miginfocom.swing.MigLayout 288 43 3 28
net.miginfocom.layout.PlatformDefaults 274 45 0 43
net.miginfocom.demo.HiDPISimulator 230 7 7 1
net.miginfocom.swing.SwingComponentWrapper 229 37 0 1
net.miginfocom.layout.LC 227 82 0 80
net.miginfocom.swt.MigLayout 203 33 1 24
net.miginfocom.layout.LayoutUtil 201 29 1 22
net.miginfocom.swt.SwtComponentWrapper 160 37 0 3
net.miginfocom.layout.AC 136 36 0 33
net.miginfocom.layout.Grid.CompWrap 121 18 0 1
net.miginfocom.layout.DimConstraint 104 35 0 26
net.miginfocom.layout.LinkHandler 92 7 0 3
net.miginfocom.layout.BoundSize 88 16 1 13
net.miginfocom.demo.SwingDemo.ConstraintsDialog 82 7 1 0
net.miginfocom.demo.CallbackDemo 81 11 4 0
net.miginfocom.demo.HiDPIDemoPanel 78 2 2 0
net.miginfocom.demo.SwtDemo.Thread 55 1 5 0
net.miginfocom.layout.Grid.LinkedDimGroup 51 5 0 1
net.miginfocom.layout.ComponentWrapper 49 28 0 29
net.miginfocom.demo.SwingDemo.Thread 45 1 2 0
net.miginfocom.demo.SwingDemo.ConstraintListener 42 3 0 0
net.miginfocom.demo.HiDPISimulator.ActionListener 39 1 0 0
net.miginfocom.examples.SwtTest 39 1 2 0

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
net.miginfocom.layout.CC 463 130 0 125
net.miginfocom.layout.LC 227 82 0 80
net.miginfocom.layout.Grid 1308 64 4 23
net.miginfocom.demo.SwingDemo 1515 53 15 0
net.miginfocom.demo.SwtDemo 1123 50 7 0
net.miginfocom.layout.PlatformDefaults 274 45 0 43
net.miginfocom.swing.MigLayout 288 43 3 28
net.miginfocom.swing.SwingComponentWrapper 229 37 0 1
net.miginfocom.swt.SwtComponentWrapper 160 37 0 3
net.miginfocom.layout.AC 136 36 0 33
net.miginfocom.layout.DimConstraint 104 35 0 26
net.miginfocom.swt.MigLayout 203 33 1 24
net.miginfocom.layout.UnitValue 291 31 1 8
net.miginfocom.layout.LayoutUtil 201 29 1 22
net.miginfocom.layout.ComponentWrapper 49 28 0 29
net.miginfocom.layout.ConstraintParser 833 24 0 22
net.miginfocom.layout.Grid.CompWrap 121 18 0 1
net.miginfocom.layout.BoundSize 88 16 1 13
net.miginfocom.layout.IDEUtil 430 13 0 11
net.miginfocom.demo.CallbackDemo 81 11 4 0
net.miginfocom.swing.SwingContainerWrapper 34 8 0 1
net.miginfocom.swt.SwtContainerWrapper 24 8 0 1
net.miginfocom.demo.HiDPISimulator 230 7 7 1
net.miginfocom.demo.SwingDemo.ConstraintsDialog 82 7 1 0
net.miginfocom.layout.LinkHandler 92 7 0 3
net.miginfocom.layout.ContainerWrapper 6 5 0 6
net.miginfocom.layout.Grid.LinkedDimGroup 51 5 0 1
net.miginfocom.layout.ResizeConstraint 19 5 0 1
net.miginfocom.demo.HiDPISimulator.JPanel 18 3 0 0
net.miginfocom.demo.SwingDemo.ConstraintListener 42 3 0 0

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
94.27 8,929.00 0.64 9.44 5.09

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
net.miginfocom.layout.ConstraintParser.parseComponentConstraint(String) 288 138 1
net.miginfocom.layout.Grid.Grid(ContainerWrapper,LC,AC,AC,CC,LayoutCallback) 198 117 1
net.miginfocom.layout.ConstraintParser.parseLayoutConstraint(String) 150 80 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(IllegalStateException[][][],ResizeConstraint[],Float[],int,int) 61 31 1
net.miginfocom.demo.SwtDemo.doBenchmark() 59 1 0
net.miginfocom.layout.Grid.sortCellsByPlatform(Cell,ContainerWrapper) 58 24 1
net.miginfocom.demo.SwtDemo.createLayout_Showdown(Composite) 57 1 0
net.miginfocom.layout.Grid.calcRowsOrColsSizes(boolean) 56 24 1
net.miginfocom.layout.IDEUtil.addComponentDimConstraintString(DimConstraint,StringBuffer,boolean,boolean,boolean) 56 39 1
net.miginfocom.swing.SwingComponentWrapper.checkType(boolean) 56 45 0
net.miginfocom.demo.SwtDemo.Thread.run() 55 11 0
net.miginfocom.demo.SwingDemo.createGrowing() 54 1 0
net.miginfocom.layout.Grid.layout(boolean[],UnitValue,UnitValue,boolean,boolean) 54 30 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.demo.SwingDemo.main(String[]) 48 15 0

Averages.

Program NCSS NCSS average CCN average Javadocs average
8,929.00 9.10 3.59 0.50

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