JavaNCSS Metric Results

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

The following document contains the results of a JavaNCSS metric analysis, using JavaNCSS version 33.54.
JavaNCSS web site.

Packages

Packages

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

Packages sorted by NCSS.

Package Classes Methods NCSS Javadocs Javadoc lines Single lines comment Multi lines comment
org.opentrafficsim.core.units.distributions 8 10 701 54 236 4 16
org.opentrafficsim.gui 7 39 624 66 291 54 46
org.opentrafficsim.core.geometry 6 63 442 69 319 18 26
org.opentrafficsim.simulationengine.properties 10 101 418 117 476 7 23
org.opentrafficsim.core.network.factory.xml.units 8 35 413 43 223 8 15
org.opentrafficsim.core.network 12 110 367 119 437 8 95
org.opentrafficsim.simulationengine 8 29 257 37 227 37 19
org.opentrafficsim.core.gtu 7 48 250 61 217 1 63
org.opentrafficsim.core.network.route 7 34 203 45 248 1 25
org.opentrafficsim.core.dsol 10 53 181 63 207 3 41
org.opentrafficsim.core.gtu.animation 7 23 176 35 166 3 26
org.opentrafficsim.core.gtu2 4 32 164 42 142 0 29
org.opentrafficsim.core.network.animation 3 6 68 9 52 1 11
org.opentrafficsim.core 2 0 6 2 20 2 0
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
99 583 4270 762 3261 147 435

Objects

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
org.opentrafficsim.gui.OTSControlPanel 328 18 6 39
org.opentrafficsim.core.geometry.OTSLine3D 166 25 0 26
org.opentrafficsim.core.geometry.OTSBuffering 124 5 0 6
org.opentrafficsim.core.units.distributions.ContinuousDistDoubleScalar 123 0 2 9
org.opentrafficsim.core.units.distributions.ContinuousDistFloatScalar 123 0 2 9
org.opentrafficsim.core.units.distributions.DiscreteDistDoubleScalar 123 0 2 9
org.opentrafficsim.core.units.distributions.DiscreteDistFloatScalar 123 0 2 9
org.opentrafficsim.simulationengine.SimpleAnimator 107 4 0 5
org.opentrafficsim.core.gtu.RelativePosition 105 9 1 16
org.opentrafficsim.core.gtu2.RelativePosition 105 9 1 16
org.opentrafficsim.core.network.factory.xml.units.Distributions 94 9 0 10
org.opentrafficsim.simulationengine.properties.CompoundProperty 87 16 1 17
org.opentrafficsim.core.network.OTSNetwork 84 24 0 25
org.opentrafficsim.core.network.OTSLink 74 14 0 15
org.opentrafficsim.core.geometry.OTSPoint3D 70 19 0 20
org.opentrafficsim.core.network.factory.xml.units.LengthUnits 67 6 0 7
org.opentrafficsim.core.network.factory.xml.units.TimeUnits 67 6 0 7
org.opentrafficsim.simulationengine.properties.ProbabilityDistributionProperty 65 14 0 15
org.opentrafficsim.gui.ProbabilityDistributionEditor 58 6 0 7
org.opentrafficsim.core.network.OTSNode 57 15 0 16
org.opentrafficsim.gui.ColorControlPanel 48 4 0 5
org.opentrafficsim.simulationengine.AbstractWrappableAnimation 45 8 0 9
org.opentrafficsim.core.gtu.GTUType 44 6 0 7
org.opentrafficsim.simulationengine.properties.ContinuousProperty 41 11 0 12
org.opentrafficsim.simulationengine.properties.IntegerProperty 41 11 0 12
org.opentrafficsim.core.network.route.ProbabilisticRouteGenerator 40 2 1 7
org.opentrafficsim.core.network.factory.xml.units.Colors 39 2 0 3
org.opentrafficsim.core.network.route.Route 39 12 0 13
org.opentrafficsim.simulationengine.properties.SelectionProperty 39 10 0 11
org.opentrafficsim.core.gtu.animation.AccelerationGTUColorer 36 4 0 5

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
org.opentrafficsim.core.geometry.OTSLine3D 166 25 0 26
org.opentrafficsim.core.network.OTSNetwork 84 24 0 25
org.opentrafficsim.core.network.Network 23 22 0 23
org.opentrafficsim.core.geometry.OTSPoint3D 70 19 0 20
org.opentrafficsim.gui.OTSControlPanel 328 18 6 39
org.opentrafficsim.core.gtu.GTU 17 16 0 17
org.opentrafficsim.simulationengine.properties.CompoundProperty 87 16 1 17
org.opentrafficsim.core.network.OTSNode 57 15 0 16
org.opentrafficsim.core.gtu2.GTU 15 14 0 15
org.opentrafficsim.core.network.OTSLink 74 14 0 15
org.opentrafficsim.simulationengine.properties.ProbabilityDistributionProperty 65 14 0 15
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface 14 13 0 14
org.opentrafficsim.core.network.route.Route 39 12 0 13
org.opentrafficsim.simulationengine.properties.AbstractProperty 36 11 1 18
org.opentrafficsim.simulationengine.properties.ContinuousProperty 41 11 0 12
org.opentrafficsim.simulationengine.properties.IntegerProperty 41 11 0 12
org.opentrafficsim.core.dsol.OTSSimTimeDouble 24 10 0 11
org.opentrafficsim.core.network.Node 11 10 0 11
org.opentrafficsim.simulationengine.properties.SelectionProperty 39 10 0 11
org.opentrafficsim.core.gtu.RelativePosition 105 9 1 16
org.opentrafficsim.core.gtu2.RelativePosition 105 9 1 16
org.opentrafficsim.core.network.factory.xml.units.Distributions 94 9 0 10
org.opentrafficsim.core.network.Link 10 9 0 10
org.opentrafficsim.core.dsol.OTSDEVSRealTimeClock 20 8 0 9
org.opentrafficsim.simulationengine.AbstractWrappableAnimation 45 8 0 9
org.opentrafficsim.simulationengine.properties.BooleanProperty 27 8 0 9
org.opentrafficsim.simulationengine.properties.StringProperty 27 8 0 9
org.opentrafficsim.core.dsol.OTSDEVSAnimator 18 7 0 8
org.opentrafficsim.core.network.LinkLocation 23 7 0 8
org.opentrafficsim.simulationengine.properties.IDMPropertySet 24 7 0 8

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
35.63 4,270.00 0.24 5.89 7.70

Methods

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
org.opentrafficsim.core.geometry.OTSBuffering.offsetGeometry(OTSLine3D,double) 76 39 1
org.opentrafficsim.core.units.distributions.ContinuousDistDoubleScalar.Abs.draw() 56 53 1
org.opentrafficsim.core.units.distributions.ContinuousDistDoubleScalar.Rel.draw() 56 53 1
org.opentrafficsim.core.units.distributions.ContinuousDistFloatScalar.Abs.draw() 56 53 1
org.opentrafficsim.core.units.distributions.ContinuousDistFloatScalar.Rel.draw() 56 53 1
org.opentrafficsim.core.units.distributions.DiscreteDistDoubleScalar.Abs.draw() 56 53 1
org.opentrafficsim.core.units.distributions.DiscreteDistDoubleScalar.Rel.draw() 56 53 1
org.opentrafficsim.core.units.distributions.DiscreteDistFloatScalar.Abs.draw() 56 53 1
org.opentrafficsim.core.units.distributions.DiscreteDistFloatScalar.Rel.draw() 56 53 1
org.opentrafficsim.gui.OTSControlPanel.TimeWarpPanel.TimeWarpPanel(double,double,double,int,DEVSSimulatorInterface) 56 15 1
org.opentrafficsim.simulationengine.SimpleAnimator.runOld() 49 17 1
org.opentrafficsim.simulationengine.SimpleAnimator.run() 48 17 1
org.opentrafficsim.core.geometry.OTSBuffering.offsetLine(OTSLine3D,double,double) 38 11 1
org.opentrafficsim.core.network.factory.xml.units.Colors.parseColor(String) 37 32 1
org.opentrafficsim.core.network.factory.xml.units.Distributions.makeDistContinuous(String,String[]) 37 35 1
org.opentrafficsim.gui.OTSControlPanel.actionPerformed(ActionEvent) 37 15 1
org.opentrafficsim.gui.ProbabilityDistributionEditor.ProbabilityDistributionEditor(String[],Double[]) 34 3 1
org.opentrafficsim.core.gtu.RelativePosition.equals(Object) 33 27 1
org.opentrafficsim.core.gtu2.RelativePosition.equals(Object) 33 27 1
org.opentrafficsim.core.network.OTSLink.equals(Object) 27 22 1
org.opentrafficsim.core.geometry.OTSLine3D.equals(Object) 25 21 1
org.opentrafficsim.simulationengine.AbstractWrappableAnimation.buildAnimator(Time.Abs,Time.Rel,Time.Rel,AbstractProperty,Rectangle,boolean) 24 8 1
org.opentrafficsim.gui.OTSControlPanel.autoPauseSimulator() 22 7 1
org.opentrafficsim.gui.OTSControlPanel.OTSControlPanel(OTSDEVSSimulatorInterface,WrappableAnimation) 21 1 1
org.opentrafficsim.simulationengine.properties.CompoundProperty.displayOrderedValue() 21 1 1
org.opentrafficsim.core.network.animation.PaintPolygons.paintMultiPolygon(Graphics2D,Color,DirectedPoint,OTSLine3D) 20 6 1
org.opentrafficsim.gui.OTSControlPanel.fixButtons() 20 8 1
org.opentrafficsim.core.geometry.OTSLine3D.calcCentroidBounds() 19 2 1
org.opentrafficsim.core.geometry.OTSLine3D.getLocationSI(double) 18 8 1
org.opentrafficsim.core.network.route.ProbabilisticRouteGenerator.ProbabilisticRouteGenerator(RouteProbability,StreamInterface) 18 7 1

Averages.

Program NCSS NCSS average CCN average Javadocs average
4,270.00 4.85 2.74 0.99

Explanations

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