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 17 381 2720 446 4448 202 578
org.apache.commons.text.translate 14 45 654 60 381 314 312
org.apache.commons.text.similarity 19 54 594 69 897 94 525
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
59 509 4153 618 6260 621 1607

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 311 55 0 56
org.apache.commons.text.StrTokenizer 308 64 0 65
org.apache.commons.text.translate.EntityArrays 301 1 0 2
org.apache.commons.text.ExtendedMessageFormat 218 21 0 22
org.apache.commons.text.WordUtils 215 17 0 18
org.apache.commons.text.StringEscapeUtils 182 19 2 26
org.apache.commons.text.similarity.LevenshteinDetailedDistance 170 8 0 9
org.apache.commons.text.AlphabetConverter 147 14 0 12
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.RandomStringGenerator 70 3 1 9
org.apache.commons.text.similarity.JaroWinklerDistance 55 2 0 3
org.apache.commons.text.translate.NumericEntityUnescaper 46 3 1 4
org.apache.commons.text.similarity.LongestCommonSubsequence 38 3 0 4
org.apache.commons.text.translate.CharSequenceTranslator 38 5 0 6
org.apache.commons.text.translate.LookupTranslator 36 2 0 3
org.apache.commons.text.translate.UnicodeEscaper 36 8 0 9
org.apache.commons.text.StrLookup 30 5 2 11
org.apache.commons.text.similarity.LevenshteinResults 29 8 0 6
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.translate.CsvTranslators 26 1 2 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

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 311 55 0 56
org.apache.commons.text.ExtendedMessageFormat 218 21 0 22
org.apache.commons.text.StringEscapeUtils 182 19 2 26
org.apache.commons.text.WordUtils 215 17 0 18
org.apache.commons.text.StrMatcher 91 16 5 32
org.apache.commons.text.AlphabetConverter 147 14 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 30 5 2 11
org.apache.commons.text.translate.CharSequenceTranslator 38 5 0 6
org.apache.commons.text.diff.ReplacementsFinder 22 4 0 5
org.apache.commons.text.similarity.EditDistanceFrom 13 4 0 5
org.apache.commons.text.similarity.SimilarityScoreFrom 13 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.RandomStringGenerator 70 3 1 9
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

Averages.

NCSS average Program NCSS Classes average Methods average Javadocs average
66.83 4,153.00 0.29 8.63 10.47

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) 87 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.WordUtils.wrap(String,int,String,boolean,String) 48 15 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.WordUtils.swapCase(String) 30 8 1
org.apache.commons.text.ExtendedMessageFormat.insertFormats(String,String) 28 9 1
org.apache.commons.text.RandomStringGenerator.generate(int) 25 11 1
org.apache.commons.text.StrBuilder.readFrom(Readable) 25 6 1
org.apache.commons.text.WordUtils.capitalize(String,char) 24 8 1
org.apache.commons.text.WordUtils.uncapitalize(String,char) 24 8 1
org.apache.commons.text.WordUtils.abbreviate(String,int,int,String) 23 10 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.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.CharSequenceTranslator.translate(CharSequence,Writer) 20 9 1

Averages.

Program NCSS NCSS average CCN average Javadocs average
4,153.00 5.95 3.04 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).