Apache Commons logo Commons Text

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
org.apache.commons.text 14 362 2367 418 3747 213 498
org.apache.commons.text.similarity 19 54 595 69 896 94 520
org.apache.commons.text.translate 13 54 400 66 432 317 231
org.apache.commons.text.diff 9 29 185 43 534 11 192
Classes total Methods total NCSS total Javadocs Javadoc lines Single lines comment Multi lines comment
55 499 3547 596 5609 635 1441

Objects

Objects

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

TOP 30 classes containing the most NCSS.

Object NCSS Methods Classes Javadocs
org.apache.commons.text.StrBuilder 991 149 3 173
org.apache.commons.text.StrSubstitutor 313 55 0 56
org.apache.commons.text.StrTokenizer 308 64 0 65
org.apache.commons.text.ExtendedMessageFormat 218 21 0 22
org.apache.commons.text.similarity.LevenshteinDetailedDistance 170 8 0 9
org.apache.commons.text.AlphabetConverter 151 14 0 12
org.apache.commons.text.StringEscapeUtils 127 21 4 27
org.apache.commons.text.similarity.LevenshteinDistance 98 7 0 8
org.apache.commons.text.diff.StringsComparator 96 5 1 11
org.apache.commons.text.StrMatcher 91 16 5 32
org.apache.commons.text.translate.SingleLookupTranslator 59 3 0 3
org.apache.commons.text.similarity.JaroWinklerDistance 57 2 0 3
org.apache.commons.text.translate.NumericEntityUnescaper 46 3 1 4
org.apache.commons.text.translate.CharSequenceTranslator 39 5 0 6
org.apache.commons.text.similarity.LongestCommonSubsequence 38 3 0 4
org.apache.commons.text.translate.EntityArrays 37 11 0 12
org.apache.commons.text.translate.UnicodeEscaper 36 8 0 9
org.apache.commons.text.translate.LookupTranslator 33 2 0 3
org.apache.commons.text.similarity.LevenshteinResults 29 8 0 6
org.apache.commons.text.StrLookup 29 5 2 11
org.apache.commons.text.translate.NumericEntityEscaper 29 7 0 8
org.apache.commons.text.FormattableUtils 28 6 0 7
org.apache.commons.text.similarity.FuzzyScore 28 3 0 4
org.apache.commons.text.similarity.CosineSimilarity 27 3 0 4
org.apache.commons.text.diff.EditScript 24 7 0 8
org.apache.commons.text.diff.ReplacementsFinder 22 4 0 5
org.apache.commons.text.similarity.JaccardSimilarity 22 2 0 3
org.apache.commons.text.translate.OctalUnescaper 20 3 0 4
org.apache.commons.text.CompositeFormat 17 6 0 7
org.apache.commons.text.translate.UnicodeUnescaper 17 1 0 2

TOP 30 classes containing the most methods.

Object NCSS Methods Classes Javadocs
org.apache.commons.text.StrBuilder 991 149 3 173
org.apache.commons.text.StrTokenizer 308 64 0 65
org.apache.commons.text.StrSubstitutor 313 55 0 56
org.apache.commons.text.ExtendedMessageFormat 218 21 0 22
org.apache.commons.text.StringEscapeUtils 127 21 4 27
org.apache.commons.text.StrMatcher 91 16 5 32
org.apache.commons.text.AlphabetConverter 151 14 0 12
org.apache.commons.text.translate.EntityArrays 37 11 0 12
org.apache.commons.text.similarity.LevenshteinDetailedDistance 170 8 0 9
org.apache.commons.text.similarity.LevenshteinResults 29 8 0 6
org.apache.commons.text.translate.UnicodeEscaper 36 8 0 9
org.apache.commons.text.diff.EditScript 24 7 0 8
org.apache.commons.text.similarity.LevenshteinDistance 98 7 0 8
org.apache.commons.text.translate.NumericEntityEscaper 29 7 0 8
org.apache.commons.text.CompositeFormat 17 6 0 7
org.apache.commons.text.FormattableUtils 28 6 0 7
org.apache.commons.text.translate.JavaUnicodeEscaper 14 6 0 7
org.apache.commons.text.diff.StringsComparator 96 5 1 11
org.apache.commons.text.StrLookup 29 5 2 11
org.apache.commons.text.translate.CharSequenceTranslator 39 5 0 6
org.apache.commons.text.diff.ReplacementsFinder 22 4 0 5
org.apache.commons.text.similarity.EditDistanceFrom 14 4 0 5
org.apache.commons.text.similarity.SimilarityScoreFrom 14 4 0 5
org.apache.commons.text.diff.CommandVisitor 4 3 0 4
org.apache.commons.text.diff.EditCommand 7 3 0 4
org.apache.commons.text.similarity.CosineSimilarity 27 3 0 4
org.apache.commons.text.similarity.FuzzyScore 28 3 0 4
org.apache.commons.text.similarity.LongestCommonSubsequence 38 3 0 4
org.apache.commons.text.translate.NumericEntityUnescaper 46 3 1 4
org.apache.commons.text.translate.OctalUnescaper 20 3 0 4

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
61.24 3,547.00 0.29 9.07 10.84

Methods

Methods

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

TOP 30 Methods containing the most NCSS.

Methods NCSS CCN Javadocs
org.apache.commons.text.StrSubstitutor.substitute(StrBuilder,int,int,String) 85 23 1
org.apache.commons.text.similarity.LevenshteinDetailedDistance.findDetailedResults(CharSequence,CharSequence,CharSequence[][],boolean) 56 27 1
org.apache.commons.text.similarity.LevenshteinDetailedDistance.limitedCompare(CharSequence,CharSequence,int) 54 25 1
org.apache.commons.text.ExtendedMessageFormat.applyPattern(String) 51 18 1
org.apache.commons.text.similarity.LevenshteinDistance.limitedCompare(CharSequence,CharSequence,int) 46 23 1
org.apache.commons.text.AlphabetConverter.createConverter(Integer[],Integer[],Integer[]) 43 14 1
org.apache.commons.text.similarity.LevenshteinDetailedDistance.unlimitedCompare(CharSequence,CharSequence) 43 15 1
org.apache.commons.text.similarity.JaroWinklerDistance.matches(CharSequence,CharSequence) 42 14 1
org.apache.commons.text.diff.StringsComparator.getMiddleSnake(int,int,int,int) 40 31 1
org.apache.commons.text.StrTokenizer.readWithQuotes(int[],int,int,StrBuilder,String,int,int) 40 11 1
org.apache.commons.text.translate.NumericEntityUnescaper.translate(CharSequence,int,Writer) 36 28 1
org.apache.commons.text.similarity.LevenshteinDistance.unlimitedCompare(CharSequence,CharSequence) 35 13 1
org.apache.commons.text.ExtendedMessageFormat.insertFormats(String,String) 28 9 1
org.apache.commons.text.translate.SingleLookupTranslator.SingleLookupTranslator(String[][]) 28 8 1
org.apache.commons.text.StrBuilder.readFrom(Readable) 25 6 1
org.apache.commons.text.diff.StringsComparator.buildScript(int,int,int,int,Character) 22 13 1
org.apache.commons.text.ExtendedMessageFormat.readArgumentIndex(String,ParsePosition) 21 14 1
org.apache.commons.text.ExtendedMessageFormat.parseFormatDescription(String,ParsePosition) 21 8 1
org.apache.commons.text.translate.CharSequenceTranslator.translate(CharSequence,Writer) 21 11 1
org.apache.commons.text.AlphabetConverter.decode(String) 20 9 1
org.apache.commons.text.AlphabetConverter.addSingleEncoding(int,String,Integer,Integer,String) 20 10 1
org.apache.commons.text.similarity.FuzzyScore.fuzzyScore(CharSequence,CharSequence) 20 9 1
org.apache.commons.text.similarity.LongestCommonSubsequence.logestCommonSubsequence(CharSequence,CharSequence) 20 7 1
org.apache.commons.text.StrBuilder.insert(int,boolean) 20 2 1
org.apache.commons.text.StrBuilder.indexOf(String,int) 20 15 1
org.apache.commons.text.translate.SingleLookupTranslator.translate(CharSequence,int,Writer) 19 10 1
org.apache.commons.text.StrBuilder.lastIndexOf(String,int) 18 15 1
org.apache.commons.text.similarity.CosineSimilarity.cosineSimilarity(Integer,Integer) 17 8 1
org.apache.commons.text.similarity.JaccardSimilarity.calculateJaccardSimilarity(CharSequence,CharSequence) 17 8 1
org.apache.commons.text.StringEscapeUtils.XsiUnescaper.translate(CharSequence,int,Writer) 17 7 0

Averages.

Program NCSS NCSS average CCN average Javadocs average
3,547.00 5.74 2.98 0.97

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