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
com.nickokiss.investor.calc 8 84 443 46 399 56 160
com.nickokiss.investor.fin.element 9 80 315 10 59 1 180
com.nickokiss.investor.fin.env 7 28 113 12 57 9 140
com.nickokiss.investor.functioncalc 3 8 85 3 13 0 60
com.nickokiss.investor.function 5 9 67 5 21 0 100
com.nickokiss.investor.util 3 13 52 3 12 118 60
com.nickokiss.investor.fin.element.creator 2 3 21 2 9 0 40
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
37 225 1096 81 570 184 740

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
com.nickokiss.investor.calc.CashFlowStreamCalc 97 17 0 3
com.nickokiss.investor.calc.BondCalc 93 22 0 7
com.nickokiss.investor.fin.element.CashFlowStream 85 22 1 1
com.nickokiss.investor.calc.CompoundInterestCalc 64 14 0 11
com.nickokiss.investor.fin.element.Bond 50 19 0 2
com.nickokiss.investor.fin.element.StreamElement 50 13 0 1
com.nickokiss.investor.functioncalc.Div2FunctionCalc 49 6 0 1
com.nickokiss.investor.calc.ContCompInterestCalc 42 11 0 10
com.nickokiss.investor.util.Range 37 12 0 1
com.nickokiss.investor.fin.element.CashFlowPVComparator 28 8 0 1
com.nickokiss.investor.fin.env.PeriodicCompoundingStrategy 28 7 0 4
com.nickokiss.investor.calc.AnnuityCalc 27 5 0 6
com.nickokiss.investor.calc.MathCalc 27 9 0 1
com.nickokiss.investor.fin.env.Env 25 9 0 1
com.nickokiss.investor.calc.SimpleInterestCalc 22 4 0 5
com.nickokiss.investor.fin.element.Annuity 22 8 0 1
com.nickokiss.investor.calc.PortfolioCalc 21 2 0 3
com.nickokiss.investor.functioncalc.IterativeFunctionCalc 17 1 0 1
com.nickokiss.investor.fin.element.CashFlowIRRComparator 16 4 0 1
com.nickokiss.investor.fin.env.ContinuousCompoundingStrategy 16 3 0 3
com.nickokiss.investor.function.InfiniteStreamPVFunction 15 2 0 1
com.nickokiss.investor.fin.element.Portfolio 14 4 0 1
com.nickokiss.investor.function.BondPriceFunction 13 2 0 1
com.nickokiss.investor.fin.element.creator.AddingElementCreator 12 2 0 1
com.nickokiss.investor.fin.env.GeneralInterestRateStrategy 9 2 0 1
com.nickokiss.investor.fin.env.ConstantInterestRateStrategy 8 3 0 1
com.nickokiss.investor.function.CashFlowPresentValueFunction 8 2 0 1
com.nickokiss.investor.function.EffectiveInterestRateFunction 7 2 0 1
com.nickokiss.investor.fin.element.StreamElementType 5 1 0 1
com.nickokiss.investor.util.TkFinConstants 5 0 0 1

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
com.nickokiss.investor.calc.BondCalc 93 22 0 7
com.nickokiss.investor.fin.element.CashFlowStream 85 22 1 1
com.nickokiss.investor.fin.element.Bond 50 19 0 2
com.nickokiss.investor.calc.CashFlowStreamCalc 97 17 0 3
com.nickokiss.investor.calc.CompoundInterestCalc 64 14 0 11
com.nickokiss.investor.fin.element.StreamElement 50 13 0 1
com.nickokiss.investor.util.Range 37 12 0 1
com.nickokiss.investor.calc.ContCompInterestCalc 42 11 0 10
com.nickokiss.investor.calc.MathCalc 27 9 0 1
com.nickokiss.investor.fin.env.Env 25 9 0 1
com.nickokiss.investor.fin.element.Annuity 22 8 0 1
com.nickokiss.investor.fin.element.CashFlowPVComparator 28 8 0 1
com.nickokiss.investor.fin.env.PeriodicCompoundingStrategy 28 7 0 4
com.nickokiss.investor.functioncalc.Div2FunctionCalc 49 6 0 1
com.nickokiss.investor.calc.AnnuityCalc 27 5 0 6
com.nickokiss.investor.calc.SimpleInterestCalc 22 4 0 5
com.nickokiss.investor.fin.element.CashFlowIRRComparator 16 4 0 1
com.nickokiss.investor.fin.element.Portfolio 14 4 0 1
com.nickokiss.investor.fin.env.CompoundingStrategy 4 3 0 1
com.nickokiss.investor.fin.env.ConstantInterestRateStrategy 8 3 0 1
com.nickokiss.investor.fin.env.ContinuousCompoundingStrategy 16 3 0 3
com.nickokiss.investor.calc.PortfolioCalc 21 2 0 3
com.nickokiss.investor.fin.element.creator.AddingElementCreator 12 2 0 1
com.nickokiss.investor.fin.env.GeneralInterestRateStrategy 9 2 0 1
com.nickokiss.investor.function.BondPriceFunction 13 2 0 1
com.nickokiss.investor.function.CashFlowPresentValueFunction 8 2 0 1
com.nickokiss.investor.function.EffectiveInterestRateFunction 7 2 0 1
com.nickokiss.investor.function.InfiniteStreamPVFunction 15 2 0 1
com.nickokiss.investor.fin.element.creator.StreamElementCreator 2 1 0 1
com.nickokiss.investor.fin.element.FinElement 2 1 0 1

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
25.14 1,096.00 0.03 6.08 2.19

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
com.nickokiss.investor.functioncalc.Div2FunctionCalc.getParameterRange(BigDecimal,Function,BigDecimal,Range) 16 7 0
com.nickokiss.investor.functioncalc.IterativeFunctionCalc.getParameterRange(BigDecimal,Function,BigDecimal,Range) 15 3 0
com.nickokiss.investor.calc.CashFlowStreamCalc.getRunningPresentValue(CashFlowStream,Env,BigDecimal) 14 4 0
com.nickokiss.investor.fin.element.StreamElement.toString() 14 3 0
com.nickokiss.investor.calc.BondCalc.getConvexity(BigDecimal,BigDecimal,BigDecimal,BigDecimal,BigDecimal) 13 2 1
com.nickokiss.investor.calc.BondCalc.getMacaulayDuration(BigDecimal,BigDecimal,BigDecimal,BigDecimal) 11 1 1
com.nickokiss.investor.calc.CashFlowStreamCalc.getValueContComp(CashFlowStream,BigDecimal,BigDecimal) 11 2 0
com.nickokiss.investor.calc.PortfolioCalc.getDuration(Portfolio) 11 2 1
com.nickokiss.investor.functioncalc.Div2FunctionCalc.getInitialRange(BigDecimal,Function,BigDecimal) 11 2 0
com.nickokiss.investor.calc.CashFlowStreamCalc.getDuration(CashFlowStream,BigDecimal,BigDecimal) 10 2 1
com.nickokiss.investor.fin.element.CashFlowStream.getDuration(Env) 10 2 0
com.nickokiss.investor.functioncalc.Div2FunctionCalc.moveTillDirectionChange(BigDecimal,Function,BigDecimal,int,int) 10 2 0
com.nickokiss.investor.calc.AnnuityCalc.getValue(Annuity,BigDecimal,CompoundingStrategy,BigDecimal) 9 1 1
com.nickokiss.investor.calc.CashFlowStreamCalc.getInfinitePresentValue(CashFlowStream,BigDecimal,BigDecimal) 9 3 1
com.nickokiss.investor.fin.element.StreamElement.setValue(BigDecimal) 9 3 0
com.nickokiss.investor.calc.BondCalc.getCashFlowStream(BigDecimal,BigDecimal,BigDecimal,BigDecimal) 8 1 0
com.nickokiss.investor.calc.CashFlowStreamCalc.getStreamElementValue(BigDecimal,BigDecimal,BigDecimal,StreamElement) 8 1 0
com.nickokiss.investor.calc.PortfolioCalc.getPrice(Portfolio) 8 2 1
com.nickokiss.investor.fin.element.Bond.getCashFlowStream() 8 1 0
com.nickokiss.investor.fin.element.CashFlowPVComparator.compare(CashFlowStream,CashFlowStream) 8 2 0
com.nickokiss.investor.calc.BondCalc.getYield(BigDecimal,BigDecimal,BigDecimal,BigDecimal,BigDecimal,int) 7 1 0
com.nickokiss.investor.calc.CashFlowStreamCalc.getInternalRateOfReturn(CashFlowStream,int) 7 1 0
com.nickokiss.investor.fin.element.CashFlowIRRComparator.compare(CashFlowStream,CashFlowStream) 7 1 0
com.nickokiss.investor.fin.element.CashFlowStream.repeat(int) 7 4 0
com.nickokiss.investor.fin.env.PeriodicCompoundingStrategy.getDiscountFactor(BigDecimal,BigDecimal,InterestRateStrategy) 7 3 1
com.nickokiss.investor.calc.CashFlowStreamCalc.getValue(List,BigDecimal,BigDecimal,BigDecimal) 6 2 0
com.nickokiss.investor.calc.CompoundInterestCalc.getNominalInterestRate(BigDecimal,BigDecimal,BigDecimal,BigDecimal) 6 1 1
com.nickokiss.investor.calc.CompoundInterestCalc.getPeriodsPerYear(BigDecimal,BigDecimal,BigDecimal,BigDecimal) 6 1 1
com.nickokiss.investor.calc.CompoundInterestCalc.getInvestmentPeriods(BigDecimal,BigDecimal,BigDecimal,BigDecimal) 6 1 1
com.nickokiss.investor.calc.CompoundInterestCalc.getNominalInterestRate(BigDecimal,BigDecimal) 6 1 1

Averages.

Program NCSS NCSS average CCN average Javadocs average
1,096.00 3.64 1.25 0.19

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