JavaNCSS Metric Results

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

The following document contains the results of a JavaNCSS metric analysis, using JavaNCSS version 32.53.
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
gboat2.base.dao.impl 6 70 1215 13 118 85 85
gboat2.base.dao 1 9 243 4 19 36 8
gboat2.base.dao.util 3 19 136 14 85 2 8
gboat2.base.dao.aspect 2 8 115 3 56 18 16
gboat2.base.dao.dialect 1 1 12 1 8 0 4
gboat2.base.dao.exception 1 1 5 1 6 0 4
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
14 108 1726 36 292 141 125

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
gboat2.base.dao.impl.GenerateQL 616 24 0 5
gboat2.base.dao.impl.BaseDAO 483 32 3 2
gboat2.base.dao.Activator 208 9 0 4
gboat2.base.dao.util.ClassHelper 94 10 0 11
gboat2.base.dao.aspect.GboatSessionFactoryAspect 85 5 0 2
gboat2.base.dao.impl.GboatHibernateDaoSupport 39 11 0 6
gboat2.base.dao.util.GBoatDaoClassLoader 31 8 1 3
gboat2.base.dao.impl.BaseDAO.HibernateCallback 19 1 0 0
gboat2.base.dao.impl.BaseDAO.HibernateCallback 16 1 0 0
gboat2.base.dao.impl.BaseDAO.HibernateCallback 10 1 0 0
gboat2.base.dao.aspect.SessionFactoryHolder 8 3 0 1
gboat2.base.dao.dialect.MySQLExtendDialect 8 1 0 1
gboat2.base.dao.exception.TransientException 4 1 0 1
gboat2.base.dao.util.GBoatDaoClassLoader.PrivilegedAction 4 1 0 0

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
gboat2.base.dao.impl.BaseDAO 483 32 3 2
gboat2.base.dao.impl.GenerateQL 616 24 0 5
gboat2.base.dao.impl.GboatHibernateDaoSupport 39 11 0 6
gboat2.base.dao.util.ClassHelper 94 10 0 11
gboat2.base.dao.Activator 208 9 0 4
gboat2.base.dao.util.GBoatDaoClassLoader 31 8 1 3
gboat2.base.dao.aspect.GboatSessionFactoryAspect 85 5 0 2
gboat2.base.dao.aspect.SessionFactoryHolder 8 3 0 1
gboat2.base.dao.dialect.MySQLExtendDialect 8 1 0 1
gboat2.base.dao.exception.TransientException 4 1 0 1
gboat2.base.dao.impl.BaseDAO.HibernateCallback 10 1 0 0
gboat2.base.dao.impl.BaseDAO.HibernateCallback 19 1 0 0
gboat2.base.dao.impl.BaseDAO.HibernateCallback 16 1 0 0
gboat2.base.dao.util.GBoatDaoClassLoader.PrivilegedAction 4 1 0 0

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
116.07 1,726.00 0.29 7.71 2.57

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
gboat2.base.dao.impl.BaseDAO.getValue(Field,Object) 76 48 0
gboat2.base.dao.impl.BaseDAO.getPage(Object) 74 23 0
gboat2.base.dao.impl.GenerateQL.dealFieldForVo(String,Class,Dialect,String,String,String,String) 67 28 0
gboat2.base.dao.impl.GenerateQL.dealFieldForPo(String,Class,Dialect,String,String,String,String) 65 27 0
gboat2.base.dao.impl.BaseDAO.getPageByHql(String,Object) 59 19 0
gboat2.base.dao.Activator.registerPOJO() 54 17 1
gboat2.base.dao.impl.GenerateQL.generateSqlFromVO(Object,Class,Dialect) 54 33 1
gboat2.base.dao.aspect.GboatSessionFactoryAspect.dynamicSetSessionFactory(JoinPoint) 53 21 0
gboat2.base.dao.Activator.parseBundleClasses() 46 15 0
gboat2.base.dao.impl.GenerateQL.getColumnName(Class,String) 45 26 0
gboat2.base.dao.impl.GenerateQL.generateHqlFromPO(Object,Class,Dialect) 41 23 0
gboat2.base.dao.impl.BaseDAO.convertResultToVO(Class,List) 40 18 0
gboat2.base.dao.impl.GenerateQL.dealTableRelations(Class,StringBuffer,Object) 37 13 0
gboat2.base.dao.impl.BaseDAO.queryList(Object) 32 10 0
gboat2.base.dao.impl.BaseDAO.convertParamsForPO(Object,Class) 30 14 0
gboat2.base.dao.impl.GenerateQL.dealRelationByOn(String,Class,Class,Object) 30 8 0
gboat2.base.dao.Activator.getClasses(String,Bundle) 27 12 1
gboat2.base.dao.impl.GenerateQL.dealSelectFields(Class,StringBuffer) 26 10 0
gboat2.base.dao.Activator.bundleChanged(BundleEvent) 24 10 0
gboat2.base.dao.aspect.GboatSessionFactoryAspect.validateVo(Class) 23 12 1
gboat2.base.dao.impl.GenerateQL.dealOrderby(Class,StringBuffer,String) 23 9 0
gboat2.base.dao.impl.GenerateQL.getBlockValue(String,Class) 22 9 0
gboat2.base.dao.impl.GenerateQL.trancateValueForUrl(Object,StringBuffer) 22 9 0
gboat2.base.dao.impl.BaseDAO.createSQLQuery(String,Object) 21 1 0
gboat2.base.dao.impl.GenerateQL.convertFieldToDbColumn(String,Class) 21 12 1
gboat2.base.dao.impl.GenerateQL.getTableClass(Object) 20 13 0
gboat2.base.dao.impl.GenerateQL.getQueryParamsAsUrlString(Object) 20 8 1
gboat2.base.dao.Activator.start(BundleContext) 19 8 0
gboat2.base.dao.impl.BaseDAO.HibernateCallback.doInHibernate(Session) 19 9 0
gboat2.base.dao.impl.BaseDAO.createHQLQuery(String,Object) 18 1 0

Averages.

Program NCSS NCSS average CCN average Javadocs average
1,726.00 14.50 6.42 0.25

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