JavaNCSS Metric Results

[ packages] [ objects] [ functions] [ explanations]

The following document contains the results of a JavaNCSSmetric analysis.

Packages

[ packages] [ objects] [ functions] [ explanations]

Packages sorted by NCSS

PackageClassesFunctions NCSS JavadocsJavadoc LinesSingle Comment LinesMulti Comment Lines
jtge.engine.io331034881336424960
jtge.engine.net1748295623024493
jtge.engine.security1640265542764464
jtge.util.grid.directiongroup1154252632640329
jtge.util.grid852200562714235
jtge.util.grid.direction1033152431941314
jtge.util.grid.builder425131251161145
jtge.engine.command1026108351731290
jtge.engine.data62496261370174
jtge.engine.handler81888251320232
jtge.util.random41782201276128
jtge.util210551060058
jtge.util.grid.torus584413640157
jtge.engine.user3420739087
Classes totalFunctions total NCSS total JavadocsJavadoc LinesSingle Comment LinesMulti Comment Lines
13746222765722797254066

Objects

[ packages] [ objects] [ functions] [ explanations]

TOP 30 classes containing the most NCSS

Object NCSS FunctionsClassesJavadocs
jtge.util.grid.Grid6513014
jtge.util.grid.directiongroup.AbstractFlatHexagonDirectionGroup4910011
jtge.util.grid.directiongroup.AbstractPeakHexagonDirectionGroup4910011
jtge.engine.io.ChannelManager481008
jtge.engine.command.Flow4510010
jtge.util.EasyMockTestCase44908
jtge.util.random.Dice43606
jtge.engine.data.Context42805
jtge.engine.security.UserChannelManager40807
jtge.engine.net.NetworkAcceptor38404
jtge.util.grid.builder.AbstractHexagonBuilder38807
jtge.util.grid.builder.FlatHexagonBuilder33606
jtge.util.grid.builder.PeakHexagonBuilder33606
jtge.util.grid.LinearTileIterator33706
jtge.engine.io.XStreamInput32405
jtge.util.grid.Coordinate3010011
jtge.util.grid.direction.Direction28607
jtge.engine.io.Input27405
jtge.engine.io.ObjectInput27405
jtge.engine.io.XStreamOutput26405
jtge.engine.net.Peer26708
jtge.engine.security.LoginHandler26405
jtge.engine.security.LoginObserver26405
jtge.engine.io.ObjectOutput25405
jtge.engine.net.NetworkConnector25203
jtge.util.grid.LinearIterator25606
jtge.engine.io.SessionManager23607
jtge.engine.net.Server23606
jtge.engine.security.UserInputOutputFactory23304
jtge.engine.io.FileInputConnector20203

TOP 30 classes containing the most functions

ObjectNCSS Functions ClassesJavadocs
jtge.util.grid.Grid6513014
jtge.util.grid.directiongroup.IDirectionGroup1211010
jtge.util.grid.IGrid1211012
jtge.engine.command.Flow4510010
jtge.engine.io.ChannelManager481008
jtge.util.grid.Coordinate3010011
jtge.util.grid.directiongroup.AbstractFlatHexagonDirectionGroup4910011
jtge.util.grid.directiongroup.AbstractPeakHexagonDirectionGroup4910011
jtge.util.EasyMockTestCase44908
jtge.engine.data.Context42805
jtge.engine.security.UserChannelManager40807
jtge.util.grid.builder.AbstractHexagonBuilder38807
jtge.engine.net.Peer26708
jtge.util.grid.LinearTileIterator33706
jtge.engine.data.AbstractContext14607
jtge.engine.io.SessionManager23607
jtge.engine.net.Server23606
jtge.util.grid.builder.FlatHexagonBuilder33606
jtge.util.grid.builder.PeakHexagonBuilder33606
jtge.util.grid.direction.Direction28607
jtge.util.grid.LinearIterator25606
jtge.util.random.Dice43606
jtge.engine.io.AsynchronousInput16506
jtge.engine.io.OutputRegistrer12506
jtge.util.grid.builder.IHexagonBuilder6506
jtge.util.grid.directiongroup.AbstractDirectionGroup20506
jtge.util.grid.directiongroup.EightDirectionGroup18506
jtge.util.grid.directiongroup.FourDirectionGroup14506
jtge.util.random.Random14506
jtge.engine.command.ICommand5405

Averages

NCSS average Program NCSSClasses averageFunctions averageJavadocs average
13.282,276.000.003.374.18

Functions

[ packages] [ objects] [ functions] [ explanations]

TOP 30 functions containing the most NCSS

Function NCSS CCNJavadoc
jtge.util.grid.builder.FlatHexagonBuilder.buildHexagon(Coordinate)1611
jtge.util.grid.builder.PeakHexagonBuilder.buildHexagon(Coordinate)1611
jtge.engine.io.XStreamInput.read()14111
jtge.engine.security.LoginHandler.LoginHandler(IInput,IUserManager,IUserHandlerFactory)1471
jtge.util.grid.Grid.Grid(int,int,IDirectionGroup,ITorus)1491
jtge.engine.net.NetworkConnector.NetworkConnector(IInputOutputFactory,IConnectionObserver,String,int)1391
jtge.engine.net.NetworkAcceptor.open()1261
jtge.util.EasyMockTestCase.runBare()1221
jtge.util.random.Dice.Dice(String)1241
jtge.engine.net.NetworkAcceptor.NetworkAcceptor(IInputOutputFactory,IConnectionObserver,int)1171
jtge.engine.security.UserInputOutputFactory.UserInputOutputFactory(IConsumer,IDisconnectionObserver,IUserManager,IInputOutputImpFactory)1171
jtge.engine.io.FileInputConnector.FileInputConnector(IInputOutputFactory,IConnectionObserver,String)1071
jtge.engine.io.FileOutputConnector.FileOutputConnector(IInputOutputFactory,IConnectionObserver,String)1071
jtge.engine.io.Input.read()1051
jtge.engine.io.InputOutputFactory.InputOutputFactory(IConsumer,IDisconnectionObserver,IInputOutputImpFactory)1071
jtge.engine.net.UserInputOutputFactoryFactory.UserInputOutputFactoryFactory(IConsumer,IInputOutputImpFactory,IUserManager)1071
jtge.util.random.Dice.toString()1031
jtge.engine.data.Context.invokeOnCallback(Object,Class,Object)970
jtge.engine.io.ObjectInput.read()971
jtge.util.grid.directiongroup.EightDirectionGroup.EightDirectionGroup()911
jtge.engine.command.Flow.filter(IFilter)841
jtge.engine.data.Context.put(Object,Object)841
jtge.engine.io.ChannelManager.opened(IInput,IOutput)851
jtge.engine.io.Input.Input(IConsumer,IDisconnectionObserver,IInputImp)851
jtge.engine.io.XStreamOutput.write(ICommand)851
jtge.engine.net.Peer.Peer(IPeerFactory)811
jtge.engine.security.UserChannelManager.disconnected(IInput,IOutput)831
jtge.util.grid.directiongroup.AbstractFlatHexagonDirectionGroup.transform(Coordinate,NorthEast)851
jtge.util.grid.directiongroup.AbstractFlatHexagonDirectionGroup.transform(Coordinate,NorthWest)851
jtge.util.grid.directiongroup.AbstractFlatHexagonDirectionGroup.transform(Coordinate,SouthEast)851
Program NCSS: NCSS average CCN averageJavadocs average
2,276.003.311.800.94

Explanations

[ packages] [ objects] [ functions] [ explanations]

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.

Actually, the NCSS counter gets incremented by one for each:

 ExamplesComment
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;
No matter how many fields get actually declared through a comma separated list, and no matter if these fields get actually initialized, only one statement is counted. So "int a, b, c = 5, d = 6;" gets only +1 count, not four or even six (let me know if there is good reason to count it differently).
Method declaration- public void cry();

- public void gib() throws DeadException {
 
Constructor declarationpublic Foo() { 
Constructor invocation- this();

- super();
 
Statement- 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
Labelfine :normal, case, default

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.

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:
  • return
  • throw

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