Example #1
0
  @Test
  public void testChooseTransform() {
    Field a = Data.makeColumnField("a", "label", new Object[] {100, 200, 300, 400, 500, 600});
    Field b = Data.makeColumnField("b", "label", new Object[] {"a", "b", "c"});
    Field c = Data.makeColumnField("d", "label", new Object[] {1, 2, 2, 2, 2, 2, 2, 3});
    Field d = Data.makeColumnField("d", "label", new Object[] {1, 1, 1, 1, 1, 2, 2, 2, 5, 10});
    Field e =
        Data.makeColumnField("e", "label", new Object[] {1, 1, 1, 1, 1, 2, 2, 2, 5, 10, 100, 1000});
    Field f =
        Data.makeColumnField("f", "label", new Object[] {0, 1, 1, 1, 1, 2, 2, 2, 5, 10, 100, 1000});
    Field g =
        Data.makeColumnField(
            "g", "label", new Object[] {-1, 1, 1, 1, 1, 2, 2, 2, 5, 10, 100, 1000});

    Auto.setTransform(a);
    Auto.setTransform(b);
    Auto.setTransform(c);
    Auto.setTransform(d);
    Auto.setTransform(e);
    Auto.setTransform(f);
    Auto.setTransform(g);

    Assert.assertEquals("linear", a.stringProperty("transform"));
    Assert.assertEquals("linear", b.stringProperty("transform"));
    Assert.assertEquals("linear", c.stringProperty("transform"));
    Assert.assertEquals("root", d.stringProperty("transform"));
    Assert.assertEquals("log", e.stringProperty("transform"));
    Assert.assertEquals("root", f.stringProperty("transform"));
    Assert.assertEquals("linear", g.stringProperty("transform"));
  }
Example #2
0
  @Test
  public void testProperties() {
    Field f = Data.makeColumnField("a", "label", new Object[0]);
    assertEquals(null, f.property("xyz"));
    f.set("xyz", "12");
    assertEquals("12", f.stringProperty("xyz"));
    assertEquals(12.00001, f.numericProperty("xyz"), 0.001);

    f.set("abc", false);
    assertEquals(Boolean.FALSE, f.property("abc"));
    f.set("abc", true);
    assertEquals(Boolean.TRUE, f.property("abc"));
  }
Example #3
0
 private boolean isRange(Field field) {
   String s = field.stringProperty("summary");
   return s != null && (s.equals("iqr") || s.equals("range"));
 }