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
moagg.game 16 164 1866 14 55 46 5
moagg.model.object.sprite 24 266 1208 0 4 12 15
moagg.game.menu 12 67 897 0 0 11 0
moagg.artwork.object 18 67 789 4 16 3 0
moagg.level.xml.object 18 100 606 0 0 0 0
moagg.game.control.handler 14 41 535 11 35 3 12
moagg.level.xml.data.object 19 141 484 2 6 0 0
moagg.level.xml.factory.object 15 19 464 0 0 3 0
moagg.game.control 7 102 387 19 93 4 32
moagg.level.xml 16 72 372 0 0 0 0
moagg.game.level.applet 11 57 362 0 0 0 0
moagg.network.packet 13 100 317 0 0 0 0
moagg.level 9 28 286 0 0 4 0
moagg.prefs.score 6 58 267 0 0 2 0
moagg.game.control.collision 4 34 260 1 5 4 0
moagg.game.startup 4 18 257 0 0 2 0
moagg.types.math 4 75 244 1 3 0 0
moagg.model.level 3 45 173 2 26 2 0
moagg.game.control.handler.explosion 6 11 172 0 0 0 54
moagg.level.converter 3 13 171 3 17 10 0
moagg.level.xml.data 6 48 151 0 0 0 0
moagg.game.control.weapon.ship 5 10 145 0 0 3 0
moagg.model.weapon 8 32 143 10 45 0 0
moagg.artwork.tiles 1 9 137 0 0 4 5
moagg.util 8 16 131 4 31 5 0
moagg.model 6 58 119 3 18 1 0
moagg.game.menu.widget 2 19 106 0 0 1 0
moagg.prefs.ghost 2 25 104 0 0 0 0
moagg.game.control.weapon.turret 3 4 102 0 0 0 0
moagg.game.control.weapon.mortar 4 5 98 0 0 0 0
moagg.game.control.handler.physic 7 8 92 3 9 18 0
moagg.types 15 15 87 0 0 0 70
moagg.game.control.weapon.tank 2 4 84 0 0 0 0
moagg.game.control.warhead.missile 2 4 80 0 0 0 0
ext.gtge.forum.main.util 1 5 79 6 19 4 0
moagg.game.control.objective 5 15 78 2 21 0 0
moagg.model.object 9 52 77 24 79 0 0
moagg.types.prefs 5 15 74 0 0 0 0
moagg.artwork.sound 3 12 66 1 5 1 0
moagg.prefs.control 1 14 65 0 0 0 0
moagg.prefs.player 1 14 65 0 0 0 0
moagg.game.control.weapon.turret.aiming 6 6 62 0 0 1 0
moagg.prefs.system 1 12 57 0 0 0 0
moagg.prefs.handicap 1 7 51 0 0 1 0
moagg.level.xml.factory 2 4 45 0 0 0 0
moagg.util.math 2 9 43 5 15 0 0
moagg.model.weapon.ship 5 12 40 3 10 1 0
moagg.game.control.weapon.sam 1 2 39 0 0 0 0
moagg.prefs.network 1 8 36 0 0 0 0
moagg.game.level 1 6 35 0 0 0 0
moagg.game.control.warhead.grenade 1 2 34 0 0 0 0
moagg.model.weapon.mortar 5 8 33 0 0 0 0
moagg.model.weapon.turret.aiming 5 6 25 0 0 0 0
moagg.artwork.font 1 4 22 0 0 0 0
moagg.model.warhead.missile 3 5 21 0 0 0 0
moagg.model.weapon.turret 4 4 21 0 0 0 0
moagg.model.warhead.grenade 1 5 18 0 0 0 0
moagg.model.weapon.tank 2 4 14 2 6 0 0
moagg.game.control.warhead 2 2 10 0 0 0 0
moagg.game.control.weapon 2 2 9 0 0 0 0
moagg.model.warhead 2 2 6 3 11 0 0
moagg.prefs 1 0 4 0 0 0 0
moagg.model.weapon.sam 1 0 3 0 0 0 0
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
368 1972 12828 123 529 146 193

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
moagg.game.LevelGameObject 355 33 9 8
moagg.game.MultiPlayerServerGameObject 280 29 2 2
moagg.game.MultiPlayerClientGameObject 269 26 0 0
moagg.game.control.collision.AbstractCollisionHandler 193 27 0 1
moagg.artwork.object.ThornImageFactory 173 6 0 2
moagg.game.MissionGameObject 166 8 0 0
moagg.game.menu.SystemMenu 119 7 0 0
moagg.artwork.tiles.TileImageFactory 118 9 2 0
moagg.model.object.sprite.Missile 114 34 3 0
moagg.game.menu.PlayerMenu 107 7 0 0
moagg.model.object.sprite.Ship 102 41 0 0
moagg.model.object.sprite.Fountain 101 15 5 0
moagg.artwork.object.BarrierImageFactory 99 5 0 1
moagg.model.object.sprite.Magnet 98 13 5 0
moagg.game.menu.ControlsMenu 98 6 0 0
moagg.model.object.sprite.Tank 93 15 7 0
moagg.game.MultiPlayerPacketConverter 93 9 0 0
moagg.level.xml.object.TurretHandler 88 7 0 0
moagg.game.control.AbstractGameControlImpl 87 23 0 0
moagg.model.object.sprite.Barrier 83 7 5 0
moagg.game.control.SinglePlayerGameControlImpl 83 23 0 0
moagg.game.StartMultiPlayerGameObject 81 5 0 0
moagg.game.startup.InitializerThread 80 5 0 0
moagg.artwork.object.MagnetImageFactory 79 3 0 0
moagg.game.menu.GhostMenu 78 6 0 0
moagg.level.MapReader 77 4 0 0
ext.gtge.forum.main.util.ModPlayer 73 5 1 6
moagg.level.xml.AbstractHandler 72 12 0 0
moagg.game.menu.AbstractMenu 72 9 1 0
moagg.types.math.Vector 71 26 0 0

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
moagg.model.object.sprite.Ship 102 41 0 0
moagg.model.object.sprite.Missile 114 34 3 0
moagg.game.LevelGameObject 355 33 9 8
moagg.game.MultiPlayerServerGameObject 280 29 2 2
moagg.game.control.collision.AbstractCollisionHandler 193 27 0 1
moagg.types.math.Vector 71 26 0 0
moagg.game.MultiPlayerClientGameObject 269 26 0 0
moagg.network.packet.UpdateShipPacket 62 24 0 0
moagg.game.control.SinglePlayerGameControlImpl 83 23 0 0
moagg.game.control.AbstractGameControlImpl 87 23 0 0
moagg.network.packet.CreateShipPacket 57 22 0 0
moagg.model.level.Level 51 20 0 0
moagg.types.math.Point 55 20 0 0
moagg.model.object.ControllableObject 20 19 0 1
moagg.types.math.Rectangle 65 19 0 1
moagg.model.Controllable 19 18 0 1
moagg.model.ControllableImpl 47 18 0 0
moagg.level.xml.data.object.FountainData 41 17 0 0
moagg.level.xml.data.object.MagnetData 41 17 0 0
moagg.model.object.sprite.Sam 41 16 0 0
moagg.level.xml.data.LevelData 42 16 0 0
moagg.model.object.MoaggGameObject 16 15 0 4
moagg.model.object.sprite.Tank 93 15 7 0
moagg.model.object.sprite.Fountain 101 15 5 0
moagg.prefs.score.Score 52 15 0 0
moagg.game.control.MultiPlayerClientGameControlImpl 36 15 0 0
moagg.game.control.InternalGameControl 16 15 0 4
moagg.prefs.player.PlayerPrefs 60 14 0 0
moagg.prefs.control.ControlPrefs 60 14 0 0
moagg.prefs.ghost.GhostFrame 37 14 0 0

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
28.94 12,828.00 0.17 5.36 0.33

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
moagg.artwork.object.ThornImageFactory.createImage(Orientation,int,int) 65 13 0
moagg.artwork.object.ThornImageFactory.getRGB(Orientation,int,int) 63 13 1
moagg.game.MultiPlayerClientGameObject.updateNetwork(long) 62 23 0
moagg.level.xml.object.TurretHandler.parsePreset(String) 56 8 0
moagg.game.startup.InitializerThread.run() 56 2 0
moagg.artwork.object.MagnetImageFactory.getImages(Orientation,int) 54 20 0
ext.gtge.forum.main.util.ModPlayer.playSound(URL) 52 4 1
ext.gtge.forum.main.util.ModPlayer.Thread$1.run() 43 7 0
moagg.game.MissionGameObject.playLevel() 41 13 0
moagg.artwork.object.BarrierImageFactory.getRGB(HVOrientation,int) 39 14 1
moagg.game.menu.PlayerMenu.update(long) 39 15 0
moagg.game.MultiPlayerServerGameObject.update(long) 39 13 0
moagg.level.xml.factory.object.TurretFactory.createTurretBarrel(TurretData.BarrelData) 36 7 0
moagg.game.MultiPlayerServerGameObject.initPlayer2(Ship) 35 9 1
moagg.level.MapReader.readMapV2(DataInputStream) 34 12 0
moagg.game.menu.SystemMenu.update(long) 34 7 0
moagg.game.MultiPlayerClientGameObject.initResources() 34 6 0
moagg.util.MatrixTool.getAverageTileValue(Matrix,MoaggGameObject,double) 33 13 1
moagg.game.control.weapon.mortar.AbstractProjectileFactoryImpl.createProjectile(Mortar,AbstractBarrel,int,InternalGameControl) 32 5 0
moagg.artwork.object.BarrierImageFactory.createImage(HVOrientation,int,boolean) 29 9 0
moagg.game.HighScoreGameObject.renderHighScores(Graphics2D) 29 3 0
moagg.level.xml.object.CrateHandler.parseType(String) 28 20 0
moagg.artwork.tiles.TileImageFactory.initTile(int,int,int,int) 28 5 0
moagg.game.MissionGameObject.update(long) 28 11 0
moagg.game.menu.ControlsMenu.update(long) 28 10 0
moagg.game.MultiPlayerServerGameObject.processPacket(NetworkPacket,MultiPlayerClientData) 28 6 0
moagg.level.xml.factory.object.CrateFactory.createObject(AbstractDecorationData) 27 5 0
moagg.game.control.handler.UpdateAngleHandler.updateAngle(ControllableObject,long) 27 13 0
moagg.game.control.handler.LandingHandler.checkShipLanded(Ship,InternalGameControl) 27 11 0
moagg.game.menu.widget.TextField.update(long) 27 10 0

Averages.

Program NCSS NCSS average CCN average Javadocs average
12,828.00 4.19 1.65 0.03

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