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
ejava.examples.ejbwar.inventory.rs 6 21 259 16 79 7 0
ejava.examples.ejbwar.inventory.bo 5 45 198 8 36 0 0
ejava.examples.ejbwar.inventory.client 2 19 134 4 23 36 0
ejava.examples.ejbwar.inventory.dao 2 22 61 2 7 3 0
ejava.examples.ejbwar.inventory.ejb 2 9 54 3 15 1 0
ejava.examples.ejbwar.inventory.rmi 2 8 47 2 9 1 0
ejava.examples.ejbwar.inventory.cdi 0 0 6 0 0 0 0
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
19 124 759 35 169 48 0

Objects

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
ejava.examples.ejbwar.inventory.client.InventoryClientImpl 92 11 0 3
ejava.examples.ejbwar.inventory.rs.TxFilter 68 9 0 1
ejava.examples.ejbwar.inventory.rs.ProductsResource 46 5 0 6
ejava.examples.ejbwar.inventory.dao.InventoryDAOImpl 38 12 0 1
ejava.examples.ejbwar.inventory.ejb.InventoryMgmtEJB 36 9 0 2
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRMIEJB 33 8 0 1
ejava.examples.ejbwar.inventory.bo.Product 30 11 0 1
ejava.examples.ejbwar.inventory.bo.Category 27 10 0 1
ejava.examples.ejbwar.inventory.rs.CategoriesResource 26 3 0 4
ejava.examples.ejbwar.inventory.bo.Products 25 10 0 1
ejava.examples.ejbwar.inventory.bo.Categories 25 10 0 1
ejava.examples.ejbwar.inventory.rs.PrettyPrinter 25 3 0 3
ejava.examples.ejbwar.inventory.bo.InventoryRepresentation 22 4 0 4
ejava.examples.ejbwar.inventory.dao.InventoryDAO 11 10 0 1
ejava.examples.ejbwar.inventory.client.InventoryClient 9 8 0 1
ejava.examples.ejbwar.inventory.rs.ResourceHelper 5 1 0 1
ejava.examples.ejbwar.inventory.ejb.InventoryResources 2 0 0 1
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRemote 1 0 0 1
ejava.examples.ejbwar.inventory.rs.Application 1 0 0 1

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
ejava.examples.ejbwar.inventory.dao.InventoryDAOImpl 38 12 0 1
ejava.examples.ejbwar.inventory.bo.Product 30 11 0 1
ejava.examples.ejbwar.inventory.client.InventoryClientImpl 92 11 0 3
ejava.examples.ejbwar.inventory.bo.Products 25 10 0 1
ejava.examples.ejbwar.inventory.bo.Categories 25 10 0 1
ejava.examples.ejbwar.inventory.bo.Category 27 10 0 1
ejava.examples.ejbwar.inventory.dao.InventoryDAO 11 10 0 1
ejava.examples.ejbwar.inventory.ejb.InventoryMgmtEJB 36 9 0 2
ejava.examples.ejbwar.inventory.rs.TxFilter 68 9 0 1
ejava.examples.ejbwar.inventory.client.InventoryClient 9 8 0 1
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRMIEJB 33 8 0 1
ejava.examples.ejbwar.inventory.rs.ProductsResource 46 5 0 6
ejava.examples.ejbwar.inventory.bo.InventoryRepresentation 22 4 0 4
ejava.examples.ejbwar.inventory.rs.CategoriesResource 26 3 0 4
ejava.examples.ejbwar.inventory.rs.PrettyPrinter 25 3 0 3
ejava.examples.ejbwar.inventory.rs.ResourceHelper 5 1 0 1
ejava.examples.ejbwar.inventory.ejb.InventoryResources 2 0 0 1
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRemote 1 0 0 1
ejava.examples.ejbwar.inventory.rs.Application 1 0 0 1

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
27.47 759.00 0.00 6.53 1.84

Methods

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
ejava.examples.ejbwar.inventory.rs.TxFilter.commit() 20 13 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.createProduct(Product,String) 18 5 1
ejava.examples.ejbwar.inventory.rs.PrettyPrinter.writeTo(Object,Class,Type,Annotation[],MediaType,Object,OutputStream) 16 7 1
ejava.examples.ejbwar.inventory.rs.TxFilter.doFilter(ServletRequest,ServletResponse,FilterChain) 12 3 0
ejava.examples.ejbwar.inventory.rs.ProductsResource.deleteProduct(int) 12 7 1
ejava.examples.ejbwar.inventory.rs.TxFilter.rollback() 11 7 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.updateProduct(Product) 10 3 0
ejava.examples.ejbwar.inventory.bo.InventoryRepresentation.toString() 9 4 1
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.findCategoryByName(String,int,int) 9 3 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.getCategory(int) 9 3 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.deleteCategory(int) 9 3 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.findProductsByName(String,int,int) 9 3 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.getProduct(int) 9 3 0
ejava.examples.ejbwar.inventory.client.InventoryClientImpl.deleteProduct(int) 9 3 0
ejava.examples.ejbwar.inventory.rs.CategoriesResource.getCategory(int) 9 5 1
ejava.examples.ejbwar.inventory.rs.ProductsResource.getProduct(int) 9 5 1
ejava.examples.ejbwar.inventory.ejb.InventoryMgmtEJB.createOrGetCategory(String) 8 3 0
ejava.examples.ejbwar.inventory.rs.TxFilter.begin() 8 5 0
ejava.examples.ejbwar.inventory.rs.ProductsResource.createProduct(String,Integer,Double,String) 8 3 1
ejava.examples.ejbwar.inventory.ejb.InventoryMgmtEJB.findCategoryByName(String,int,int) 7 2 1
ejava.examples.ejbwar.inventory.dao.InventoryDAOImpl.deleteProduct(Product) 7 4 0
ejava.examples.ejbwar.inventory.bo.InventoryRepresentation.unmarshall(T,InputStream) 6 4 1
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRMIEJB.deleteProduct(int) 6 2 0
ejava.examples.ejbwar.inventory.rs.CategoriesResource.findCategoriesByName(String,int,int) 6 3 1
ejava.examples.ejbwar.inventory.rs.CategoriesResource.deleteCategory(int) 6 3 1
ejava.examples.ejbwar.inventory.rs.ProductsResource.updateProduct(int,Product) 6 3 1
ejava.examples.ejbwar.inventory.rs.ProductsResource.findProductsByName(String,int,int) 6 3 1
ejava.examples.ejbwar.inventory.ejb.InventoryMgmtEJB.addProduct(Product,String) 5 1 0
ejava.examples.ejbwar.inventory.dao.InventoryDAOImpl.applyBounds(TypedQuery,int,int) 5 3 0
ejava.examples.ejbwar.inventory.rmi.InventoryMgmtRMIEJB.getCategory(int) 5 1 0

Averages.

Program NCSS NCSS average CCN average Javadocs average
759.00 3.72 1.81 0.13

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