diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-21 21:31:00 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-21 21:31:00 +0100 |
commit | 58d94501900849959346beb5988454122c623470 (patch) | |
tree | 236036c2b5fc505b4445c1e98a42c5dcb4bfc2d8 /sonar-duplications | |
parent | 47f803be07c81dac2396f364deca15a2bb1fa7e8 (diff) | |
download | sonarqube-58d94501900849959346beb5988454122c623470.tar.gz sonarqube-58d94501900849959346beb5988454122c623470.zip |
Fix some typos
Diffstat (limited to 'sonar-duplications')
4 files changed, 7 insertions, 6 deletions
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java index 650f9864dd5..c2174c37bd9 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java @@ -148,7 +148,7 @@ public final class Search { abstract void startOfGroup(int size, int length); /** - * Invoked as many times as leafs in the subtree, where current node is root. + * Invoked as many times as leaves in the subtree, where current node is root. * * @param start start position in generalised text * @param end end position in generalised text diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java index 6920d3c89d6..70c76aae86d 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java @@ -33,7 +33,7 @@ import com.google.common.base.Objects; * Since such a tree does not exist for all strings, S is padded with a terminal symbol not seen in the string (usually denoted $). * This ensures that no suffix is a prefix of another, and that there will be n leaf nodes, one for each of the n suffixes of S. * Since all internal non-root nodes are branching, there can be at most n − 1 such nodes, and n + (n − 1) + 1 = 2n nodes in total. - * All internal nodes and leafs have incoming edge, so number of edges equal to number of leafs plus number of inner nodes, + * All internal nodes and leaves have incoming edge, so number of edges equal to number of leaves plus number of inner nodes, * thus at most 2n - 1. * Construction takes O(n) time. * </p><p> diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java index eb793a48fee..a16b27a2612 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java @@ -34,7 +34,7 @@ public class StringSuffixTree { private final SuffixTree suffixTree; private int numberOfEdges; private int numberOfInnerNodes; - private int numberOfLeafs; + private int numberOfLeaves; public static StringSuffixTree create(String text) { return new StringSuffixTree(text); @@ -48,7 +48,7 @@ public class StringSuffixTree { while (!queue.isEmpty()) { Node node = queue.remove(); if (node.getEdges().isEmpty()) { - numberOfLeafs++; + numberOfLeaves++; } else { numberOfInnerNodes++; for (Edge edge : node.getEdges()) { @@ -68,8 +68,9 @@ public class StringSuffixTree { return numberOfInnerNodes; } + // FIXME should be renamed getNumberOfLeaves() public int getNumberOfLeafs() { - return numberOfLeafs; + return numberOfLeaves; } public int indexOf(String str) { diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeTest.java index cdbbde87c94..bc48dad5ed0 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeTest.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeTest.java @@ -50,7 +50,7 @@ public class SuffixTreeTest { String text = this.data + "$"; StringSuffixTree tree = StringSuffixTree.create(text); - assertThat("number of leafs", tree.getNumberOfLeafs(), is(text.length())); + assertThat("number of leaves", tree.getNumberOfLeafs(), is(text.length())); assertThat("number of inner nodes", tree.getNumberOfInnerNodes(), lessThan(text.length() - 1)); assertThat("number of edges", tree.getNumberOfEdges(), is(tree.getNumberOfInnerNodes() + tree.getNumberOfLeafs())); |