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 testComparatorTotallyDifferent() {
      assertTrue(comp.compare("foo", "bar") < 0.5);
    }
test_case.class_method_signature: LevenshteinTest.testComparatorTotallyDifferent()
test_case.full_signature: @Test public void testComparatorTotallyDifferent()
test_case.identifier: testComparatorTotallyDifferent
test_case.invocations: assertTrue compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testComparatorTotallyDifferent()
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: @Override
  public double compare(String s1, String s2) {   
      int len = Math.min(s1.length(), s2.length());
  
      // we know that if the outcome here is 0.5 or lower, then the
      // property will return the lower probability. so the moment we
      // learn that probability is 0.5 or lower we can return 0.0 and
      // stop. this optimization makes a perceptible improvement in
      // overall performance.
      int maxlen = Math.max(s1.length(), s2.length());
      if ((double) len / (double) maxlen <= 0.5)
        return 0.0;
  
      // if the strings are equal we can stop right here.
      if (len == maxlen && s1.equals(s2))
        return 1.0;
      
      // we couldn't shortcut, so now we go ahead and compute the full
      // metric
      int dist = Math.min(compactDistance(s1, s2), len);
      return 1.0 - (((double) dist) / ((double) len));
    }
focal_method.class_method_signature: Levenshtein.compare(String s1, String s2)
focal_method.full_signature: @Override public double compare(String s1, String s2)
focal_method.identifier: compare
focal_method.invocations: min length length max length length equals min compactDistance
focal_method.modifiers: @Override public
focal_method.parameters: (String s1, String s2)
focal_method.return: double
focal_method.signature: double compare(String s1, String s2)