test_class.declarator: comp
test_class.modifier: private
test_class.original_string: private Levenshtein comp;
test_class.type: Levenshtein
test_class.var_name: comp
test_class.file: lib/Duke/duke-core/src/test/java/no/priv/garshol/duke/comparators/LevenshteinTest.java
test_class.identifier: LevenshteinTest
test_case.body: @Test
    public void testTotallyUnlike() {
      assertEquals(4, Levenshtein.distance("abcd", "efgh"));
    }
test_case.class_method_signature: LevenshteinTest.testTotallyUnlike()
test_case.full_signature: @Test public void testTotallyUnlike()
test_case.identifier: testTotallyUnlike
test_case.invocations: assertEquals distance
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTotallyUnlike()
focal_class.file: lib/Duke/duke-core/src/main/java/no/priv/garshol/duke/comparators/Levenshtein.java
focal_class.identifier: Levenshtein
focal_class.interfaces: implements Comparator
focal_class.class_method_signature: Levenshtein.compare(String s1, String s2)
focal_class.full_signature: @Override public double compare(String s1, String s2)
focal_class.identifier: compare
focal_class.modifiers: @Override public
focal_class.parameters: (String s1, String s2)
focal_class.return: double
focal_class.signature: double compare(String s1, String s2)
focal_class.class_method_signature: Levenshtein.isTokenized()
focal_class.full_signature: @Override public boolean isTokenized()
focal_class.identifier: isTokenized
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isTokenized()
focal_class.class_method_signature: Levenshtein.distance(String s1, String s2)
focal_class.full_signature: public static int distance(String s1, String s2)
focal_class.identifier: distance
focal_class.modifiers: public static
focal_class.parameters: (String s1, String s2)
focal_class.return: int
focal_class.signature: int distance(String s1, String s2)
focal_class.class_method_signature: Levenshtein.compactDistance(String s1, String s2)
focal_class.full_signature: public static int compactDistance(String s1, String s2)
focal_class.identifier: compactDistance
focal_class.modifiers: public static
focal_class.parameters: (String s1, String s2)
focal_class.return: int
focal_class.signature: int compactDistance(String s1, String s2)
focal_method.body: public static int distance(String s1, String s2) {
      if (s1.length() == 0)
        return s2.length();
      if (s2.length() == 0)
        return s1.length();
  
      int s1len = s1.length();
      // we use a flat array for better performance. we address it by
      // s1ix + s1len * s2ix. this modification improves performance
      // by about 30%, which is definitely worth the extra complexity.
      int[] matrix = new int[(s1len + 1) * (s2.length() + 1)];
      for (int col = 0; col <= s2.length(); col++)
        matrix[col * s1len] = col;
      for (int row = 0; row <= s1len; row++)
        matrix[row] = row;
  
      for (int ix1 = 0; ix1 < s1len; ix1++) {
        char ch1 = s1.charAt(ix1);
        for (int ix2 = 0; ix2 < s2.length(); ix2++) {
          int cost;
          if (ch1 == s2.charAt(ix2))
            cost = 0;
          else
            cost = 1;
  
          int left = matrix[ix1 + ((ix2 + 1) * s1len)] + 1;
          int above = matrix[ix1 + 1 + (ix2 * s1len)] + 1;
          int aboveleft = matrix[ix1 + (ix2 * s1len)] + cost;
          matrix[ix1 + 1 + ((ix2 + 1) * s1len)] =
            Math.min(left, Math.min(above, aboveleft));
        }
      }
  
      // for (int ix1 = 0; ix1 <= s1len; ix1++) {
      //   for (int ix2 = 0; ix2 <= s2.length(); ix2++) {
      //     System.out.print(matrix[ix1 + (ix2 * s1len)] + " ");
      //   }
      //   System.out.println();
      // }
      
      return matrix[s1len + (s2.length() * s1len)];
    }
focal_method.class_method_signature: Levenshtein.distance(String s1, String s2)
focal_method.full_signature: public static int distance(String s1, String s2)
focal_method.identifier: distance
focal_method.invocations: length length length length length length length charAt length charAt min min length
focal_method.modifiers: public static
focal_method.parameters: (String s1, String s2)
focal_method.return: int
focal_method.signature: int distance(String s1, String s2)