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
palmed.edit.text241417451436658792
palmed.ui1791514804000613
palmed.edit.selection149847110545912481
palmed.edit898409954006328
palmed.command1846380593000636
palmed.file950268482290309
palmed.buffer1063248672861311
palmed.edit.scrollbar759228582632254
palmed51618619850187
palmed.edit.view749172512220221
palmed.io622111281330186
palmed.edit.util1838942032
palmed.util1416525032
palmed.option1415427032
Classes totalFunctions total NCSS total JavadocsJavadoc LinesSingle Comment LinesMulti Comment Lines
12874938017713536294414

Objects

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

TOP 30 classes containing the most NCSS

Object NCSS FunctionsClassesJavadocs
palmed.edit.text.Text15325217
palmed.ui.Toolbar14723011
palmed.edit.selection.Selection12221018
palmed.edit.text.LargeText12122017
palmed.edit.view.Viewport10926023
palmed.edit.TextBox10120021
palmed.edit.scrollbar.Scrollbar9618111
palmed.command.PreferencesDialog87805
palmed.file.FileBrowser831126
palmed.ui.Container771209
palmed.edit.text.Chunk7515014
palmed.buffer.RecordBufferManager7215012
palmed.edit.Content7019018
palmed.edit.TextArea6820014
palmed.edit.text.Cache67909
palmed.edit.text.LineDelimiterInspector6114014
palmed.PalmEd58706
palmed.ui.AboutDialog58904
palmed.buffer.Buffer5411010
palmed.edit.selection.AbstractAction5113012
palmed.ui.Button511108
palmed.edit.MonospacedFont47807
palmed.file.Directory47908
palmed.io.Record47708
palmed.edit.scrollbar.HorizontalScrollbar4216017
palmed.edit.scrollbar.VerticalScrollbar4216017
palmed.edit.selection.UndoManager42909
palmed.edit.text.MultiInputStream38809
palmed.ui.Component3611011
palmed.buffer.RecordBuffer3513014

TOP 30 classes containing the most functions

ObjectNCSS Functions ClassesJavadocs
palmed.edit.view.Viewport10926023
palmed.edit.text.Text15325217
palmed.ui.Toolbar14723011
palmed.edit.text.LargeText12122017
palmed.edit.selection.Selection12221018
palmed.edit.TextArea6820014
palmed.edit.TextBox10120021
palmed.edit.Content7019018
palmed.edit.scrollbar.Scrollbar9618111
palmed.edit.scrollbar.HorizontalScrollbar4216017
palmed.edit.scrollbar.VerticalScrollbar4216017
palmed.buffer.RecordBufferManager7215012
palmed.edit.text.Chunk7515014
palmed.edit.selection.ISelection1514015
palmed.edit.text.LineDelimiterInspector6114014
palmed.buffer.RecordBuffer3513014
palmed.edit.selection.AbstractAction5113012
palmed.edit.text.IText1413014
palmed.edit.view.IContent1413014
palmed.edit.ITextBox1312013
palmed.ui.Container771209
palmed.buffer.Buffer5411010
palmed.edit.ModificationIndicator2711012
palmed.file.FileBrowser831126
palmed.ui.Button511108
palmed.ui.Component3611011
palmed.edit.selection.UndoManager42909
palmed.edit.text.Cache67909
palmed.file.Directory47908
palmed.ui.AboutDialog58904

Averages

NCSS average Program NCSSClasses averageFunctions averageJavadocs average
25.333,801.000.055.856.02

Functions

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

TOP 30 functions containing the most NCSS

Function NCSS CCNJavadoc
palmed.edit.TextBox.keyPressed(int)38191
palmed.PalmEd.createToolbar(IBufferManager)2610
palmed.ui.Container.layoutComponents(int,int)2650
palmed.command.PreferencesDialog.PreferencesDialog(Display,Displayable,IRecordFactory,ITextBox)2071
palmed.ui.AboutDialog.AboutDialog(MIDlet,Display,Displayable)1951
palmed.command.PreferencesDialog.apply()1640
palmed.edit.text.Text.read(InputStream,Coordinate)1611
palmed.edit.scrollbar.Scrollbar.click(int,int,int)1550
palmed.edit.text.LineDelimiterInspector.inspect(int)1550
palmed.file.FileBrowser.FileBrowser(Display,Displayable)1551
palmed.edit.selection.Selection.paste(InputStream)1421
palmed.edit.text.LargeText.update()1430
palmed.edit.text.Text.write(OutputStream,Coordinate,Coordinate)1441
palmed.edit.TextBox.TextBox()1311
palmed.PalmEd.PalmEd()1331
palmed.edit.MonospacedFont.drawChars(Graphics,String,int,int,int,Image)1220
palmed.edit.text.Chunk.handle(ITextExtractor,Coordinate,Coordinate,Coordinate)1261
palmed.edit.text.Chunk.translate(Coordinate,Coordinate)1290
palmed.edit.text.Text.remove(Coordinate,Coordinate)1251
palmed.file.FileBrowser.commandAction(Command,Displayable)1251
palmed.io.Record.persist()1261
palmed.ui.Toolbar.paintButtons(Graphics)1230
palmed.ui.Toolbar.clickButton(int,int)1240
palmed.command.PreferencesDialog.appendChoice(String,String[])1120
palmed.command.PreferencesDialog.triggered(Command)1130
palmed.edit.text.Cache.wake(ICachable)1161
palmed.edit.text.LargeText.LargeText(ICache,int)1151
palmed.file.FileBrowser.createDirectory(Displayable)1110
palmed.FileOverwriteListener.select(IFile)1121
palmed.ui.InputDialog.InputDialog(String,String,IInputListener)1131
Program NCSS: NCSS average CCN averageJavadocs average
3,801.003.761.710.85

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