test_class.declarator: comp
test_class.modifier: private
test_class.original_string: private QGramComparator comp;
test_class.type: QGramComparator
test_class.var_name: comp
test_class.file: lib/Duke/duke-core/src/test/java/no/priv/garshol/duke/comparators/QGramComparatorTest.java
test_class.identifier: QGramComparatorTest
test_case.body: @Test
    public void testOneIsDifferent() {
      assertEquals((4.0 / 6.0), comp.compare("abc def", "cab def"));
    }
test_case.class_method_signature: QGramComparatorTest.testOneIsDifferent()
test_case.full_signature: @Test public void testOneIsDifferent()
test_case.identifier: testOneIsDifferent
test_case.invocations: assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOneIsDifferent()
focal_class.declarator: formula
focal_class.modifier: private
focal_class.original_string: private Formula formula;
focal_class.type: Formula
focal_class.var_name: formula
focal_class.declarator: tokenizer
focal_class.modifier: private
focal_class.original_string: private Tokenizer tokenizer;
focal_class.type: Tokenizer
focal_class.var_name: tokenizer
focal_class.declarator: q
focal_class.modifier: private
focal_class.original_string: private int q;
focal_class.type: int
focal_class.var_name: q
focal_class.file: lib/Duke/duke-core/src/main/java/no/priv/garshol/duke/comparators/QGramComparator.java
focal_class.identifier: QGramComparator
focal_class.interfaces: implements Comparator
focal_class.class_method_signature: QGramComparator.QGramComparator()
focal_class.full_signature: public  QGramComparator()
focal_class.identifier: QGramComparator
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  QGramComparator()
focal_class.class_method_signature: QGramComparator.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: QGramComparator.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: QGramComparator.setQ(int q)
focal_class.full_signature: public void setQ(int q)
focal_class.identifier: setQ
focal_class.modifiers: public
focal_class.parameters: (int q)
focal_class.return: void
focal_class.signature: void setQ(int q)
focal_class.class_method_signature: QGramComparator.setFormula(Formula formula)
focal_class.full_signature: public void setFormula(Formula formula)
focal_class.identifier: setFormula
focal_class.modifiers: public
focal_class.parameters: (Formula formula)
focal_class.return: void
focal_class.signature: void setFormula(Formula formula)
focal_class.class_method_signature: QGramComparator.setTokenizer(Tokenizer tokenizer)
focal_class.full_signature: public void setTokenizer(Tokenizer tokenizer)
focal_class.identifier: setTokenizer
focal_class.modifiers: public
focal_class.parameters: (Tokenizer tokenizer)
focal_class.return: void
focal_class.signature: void setTokenizer(Tokenizer tokenizer)
focal_class.class_method_signature: QGramComparator.pad(String s, int q, boolean front)
focal_class.full_signature: private static String pad(String s, int q, boolean front)
focal_class.identifier: pad
focal_class.modifiers: private static
focal_class.parameters: (String s, int q, boolean front)
focal_class.return: String
focal_class.signature: String pad(String s, int q, boolean front)
focal_method.body: @Override
  public double compare(String s1, String s2) {
      if (s1.equals(s2))
        return 1.0;
  
      Set<String> q1 = tokenizer.qgrams(s1, q);
      Set<String> q2 = tokenizer.qgrams(s2, q);
  
      if (q1.isEmpty() || q2.isEmpty())
        return 0.0; // division will fail
  
      int common = 0;
      for (String gram : q1)
        if (q2.contains(gram))
          common++;
  
      return formula.compute(common, q1, q2);
    }
focal_method.class_method_signature: QGramComparator.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 qgrams qgrams isEmpty isEmpty contains compute
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)