Implement the person comparator :
[Persons_Comparator.git] / src / LevenshteinDistance.java
diff --git a/src/LevenshteinDistance.java b/src/LevenshteinDistance.java
deleted file mode 100644 (file)
index 3706772..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-public class LevenshteinDistance {
-    /**
-     * @param a
-     * @param b
-     * @param c
-     * @return
-     */
-    private static int minimum(int a, int b, int c) {
-        return Math.min(Math.min(a, b), c);
-    }
-
-    /**
-     * @param lhs
-     * @param rhs
-     * @return
-     */
-    public static int computeLevenshteinDistance(CharSequence lhs, CharSequence rhs) {
-        int[][] distance = new int[lhs.length() + 1][rhs.length() + 1];
-
-        for (int i = 0; i <= lhs.length(); i++)
-            distance[i][0] = i;
-        for (int j = 1; j <= rhs.length(); j++)
-            distance[0][j] = j;
-
-        for (int i = 1; i <= lhs.length(); i++)
-            for (int j = 1; j <= rhs.length(); j++)
-                distance[i][j] = minimum(
-                        distance[i - 1][j] + 1,
-                        distance[i][j - 1] + 1,
-                        distance[i - 1][j - 1] + ((lhs.charAt(i - 1) == rhs.charAt(j - 1)) ? 0 : 1));
-
-        return distance[lhs.length()][rhs.length()];
-    }
-}