test_class.declarator: comp
test_class.modifier: private
test_class.original_string: private DiceCoefficientComparator comp;
test_class.type: DiceCoefficientComparator
test_class.var_name: comp
test_class.file: lib/Duke/duke-core/src/test/java/no/priv/garshol/duke/comparators/DiceCoefficientComparatorTest.java
test_class.identifier: DiceCoefficientComparatorTest
test_case.body: @Test
    public void testEmpty() {
      assertEquals(1.0, comp.compare("", ""));
    }
test_case.class_method_signature: DiceCoefficientComparatorTest.testEmpty()
test_case.full_signature: @Test public void testEmpty()
test_case.identifier: testEmpty
test_case.invocations: assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmpty()
focal_class.declarator: subcomp
focal_class.modifier: private
focal_class.original_string: private Comparator subcomp;
focal_class.type: Comparator
focal_class.var_name: subcomp
focal_class.file: lib/Duke/duke-core/src/main/java/no/priv/garshol/duke/comparators/DiceCoefficientComparator.java
focal_class.identifier: DiceCoefficientComparator
focal_class.interfaces: implements Comparator
focal_class.class_method_signature: DiceCoefficientComparator.DiceCoefficientComparator()
focal_class.full_signature: public  DiceCoefficientComparator()
focal_class.identifier: DiceCoefficientComparator
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  DiceCoefficientComparator()
focal_class.class_method_signature: DiceCoefficientComparator.setComparator(Comparator comp)
focal_class.full_signature: public void setComparator(Comparator comp)
focal_class.identifier: setComparator
focal_class.modifiers: public
focal_class.parameters: (Comparator comp)
focal_class.return: void
focal_class.signature: void setComparator(Comparator comp)
focal_class.class_method_signature: DiceCoefficientComparator.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: DiceCoefficientComparator.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_method.body: @Override
  public double compare(String s1, String s2) {
      if (s1.equals(s2))
        return 1.0;
  
      // tokenize
      String[] t1 = StringUtils.split(s1);
      String[] t2 = StringUtils.split(s2);
  
      // ensure that t1 is shorter than or same length as t2
      if (t1.length > t2.length) {
        String[] tmp = t2;
        t2 = t1;
        t1 = tmp;
      }
      
      // find best matches for each token in t1
      double sum = 0;
      for (int ix1 = 0; ix1 < t1.length; ix1++) {
        double highest = 0;
        for (int ix2 = 0; ix2 < t2.length; ix2++)
          highest = Math.max(highest, subcomp.compare(t1[ix1], t2[ix2]));
        sum += highest;
      }
  
      return (sum * 2) / (t1.length + t2.length);
    }
focal_method.class_method_signature: DiceCoefficientComparator.compare(String s1, String s2)
focal_method.full_signature: @Override public double compare(String s1, String s2)
focal_method.identifier: compare
focal_method.invocations: equals split split max compare
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)