示例#1
0
  @Test
  public void testRepresentations() {
    Range a = Range.make((double) 0, (double) 4, null);
    assertEquals("0\u20264", a.toString());
    assertEquals(2, Data.asNumeric(a), 0.01);

    double low = -200.5;
    double high = -100;
    Range b = Range.make(low, high, null);
    assertEquals("-200.5\u2026-100", b.toString());
    assertEquals(-150.25, Data.asNumeric(b), 0.01);

    assertNotEquals(a.hashCode(), b.hashCode());
  }
示例#2
0
 public int compareTo(Range o) {
   return Data.compare(asNumeric(), o.asNumeric());
 }