You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/12/14 21:41:23 UTC

[4/8] [text] Better JavaDoc for HammingDistance

Better JavaDoc for HammingDistance


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/5fce7f89
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/5fce7f89
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/5fce7f89

Branch: refs/heads/master
Commit: 5fce7f89410b76cd5558eb9240b1f4d58ce1cd15
Parents: 22e64f0
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:27:04 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:27:04 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/HammingDistance.java   | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/5fce7f89/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
index c7a1d63..eb21307 100644
--- a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
@@ -17,26 +17,27 @@
 package org.apache.commons.text.similarity;
 
 /**
- * <p>
  * The hamming distance between two strings of equal length is the number of
  * positions at which the corresponding symbols are different.
- * </p>
  *
  * <p>
- * For further explanation about the hamming distance, take a look at its
+ * For further explanation about the Hamming Distance, take a look at its
  * Wikipedia page at http://en.wikipedia.org/wiki/Hamming_distance.
  * </p>
  */
 public class HammingDistance implements StringMetric<Integer> {
 
     /**
-     * <p>Find the hamming distance between two strings with the same
-     * length.</p>
+     * Find the Hamming Distance between two strings with the same
+     * length.
      *
      * <p>The distance starts with zero, and for each occurrence of a
      * different character in either String, it increments the distance
      * by 1, and finally return its value.</p>
      *
+     * <p>Since the Hamming Distance can only be calculated between strings of equal length, input of different lengths
+     * will throw IllegalArgumentException</p>
+     *
      * <pre>
      * distance.compare("", "")               = 0
      * distance.compare("pappa", "pappa")     = 0
@@ -45,10 +46,10 @@ public class HammingDistance implements StringMetric<Integer> {
      * distance.compare("karolin", "kerstin"  = 3
      * </pre>
      *
-     * @param left the first string, must not be null
-     * @param right the second string, must not be null
+     * @param left the first CharSequence, must not be null
+     * @param right the second CharSequence, must not be null
      * @return distance
-     * @throws IllegalArgumentException if either String input {@code null} or
+     * @throws IllegalArgumentException if either input is {@code null} or
      *             if they do not have the same length
      */
     @Override