test_class.declarator: comp
test_class.modifier: private
test_class.original_string: private NumericComparator comp;
test_class.type: NumericComparator
test_class.var_name: comp
test_class.file: lib/Duke/duke-core/src/test/java/no/priv/garshol/duke/comparators/NumericComparatorTest.java
test_class.identifier: NumericComparatorTest
test_case.body: @Test
    public void testZero() {
      assertEquals(1.0, comp.compare("0.0", "0.0"));
    }
test_case.class_method_signature: NumericComparatorTest.testZero()
test_case.full_signature: @Test public void testZero()
test_case.identifier: testZero
test_case.invocations: assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testZero()
focal_class.declarator: minratio
focal_class.modifier: private
focal_class.original_string: private double minratio;
focal_class.type: double
focal_class.var_name: minratio
focal_class.file: lib/Duke/duke-core/src/main/java/no/priv/garshol/duke/comparators/NumericComparator.java
focal_class.identifier: NumericComparator
focal_class.interfaces: implements Comparator
focal_class.class_method_signature: NumericComparator.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: NumericComparator.setMinRatio(double minratio)
focal_class.full_signature: public void setMinRatio(double minratio)
focal_class.identifier: setMinRatio
focal_class.modifiers: public
focal_class.parameters: (double minratio)
focal_class.return: void
focal_class.signature: void setMinRatio(double minratio)
focal_class.class_method_signature: NumericComparator.compare(String v1, String v2)
focal_class.full_signature: @Override public double compare(String v1, String v2)
focal_class.identifier: compare
focal_class.modifiers: @Override public
focal_class.parameters: (String v1, String v2)
focal_class.return: double
focal_class.signature: double compare(String v1, String v2)
focal_method.body: @Override
  public double compare(String v1, String v2) {
      double d1;
      double d2;
      try {
        d1 = Double.parseDouble(v1);
        d2 = Double.parseDouble(v2);
      } catch (NumberFormatException e) {
        return 0.5; // we just ignore this. whether it's wise I'm not sure
      }
  
      // if they're both zero, they're equal
      if (d1 == 0.0 && d2 == 0.0)
        return 1.0;
  
      // if both are negative, flip the signs
      if (d1 < 0.0 && d2 < 0.0) {
        d1 *= -1.0;
        d2 *= -1.0;
      }
  
      if (d2 < d1) {
        double tmp = d2;
        d2 = d1;
        d1 = tmp;
      }
  
      double ratio = d1 / d2;
      if (ratio < minratio)
        return 0.0;
      else
        return ratio;
    }
focal_method.class_method_signature: NumericComparator.compare(String v1, String v2)
focal_method.full_signature: @Override public double compare(String v1, String v2)
focal_method.identifier: compare
focal_method.invocations: parseDouble parseDouble
focal_method.modifiers: @Override public
focal_method.parameters: (String v1, String v2)
focal_method.return: double
focal_method.signature: double compare(String v1, String v2)