Package com.google.visualization.datasource.datatable.value

Examples of com.google.visualization.datasource.datatable.value.NumberValue


    table.addColumn(new ColumnDescription("c3", ValueType.TEXT, "c3"));

    ColumnColumnFilter filter1 = new ColumnColumnFilter(new SimpleColumn("c1"),
        new SimpleColumn("c3"), ComparisonFilter.Operator.NE);
    ColumnValueFilter filter2 = new ColumnValueFilter(new SimpleColumn("c2"),
        new NumberValue(1000), ComparisonFilter.Operator.GT);
    List<QueryFilter> subfilterList = Lists.newArrayList();
    subfilterList.add(filter1);
    subfilterList.add(filter2);
    CompoundFilter compoundFilter = new CompoundFilter(
        CompoundFilter.LogicalOperator.OR, subfilterList);
View Full Code Here


    SimpleColumn col3 = new SimpleColumn("c3");
    SimpleColumn col4 = new SimpleColumn("c4");
    ColumnColumnFilter filter1 = new ColumnColumnFilter(col1, col3,
        ComparisonFilter.Operator.NE);
    ColumnValueFilter filter2 = new ColumnValueFilter(col2,
        new NumberValue(1000), ComparisonFilter.Operator.GT);
    ColumnColumnFilter filter3 = new ColumnColumnFilter(col1, col4,
        ComparisonFilter.Operator.LE);
    ColumnValueFilter filter4 = new ColumnValueFilter(col3,
        BooleanValue.TRUE, ComparisonFilter.Operator.GT);
    List<QueryFilter> subfilterList1 = Lists.newArrayList();
View Full Code Here

    SimpleColumn col3 = new SimpleColumn("c3");
    SimpleColumn col4 = new SimpleColumn("c4");
    ColumnColumnFilter filter1 = new ColumnColumnFilter(col1, col3,
        ComparisonFilter.Operator.NE);
    ColumnValueFilter filter2 = new ColumnValueFilter(col2,
        new NumberValue(1000), ComparisonFilter.Operator.GT);
    ColumnColumnFilter filter3 = new ColumnColumnFilter(col1, col4,
        ComparisonFilter.Operator.CONTAINS);
    ColumnValueFilter filter4 = new ColumnValueFilter(col3,
        BooleanValue.TRUE, ComparisonFilter.Operator.GT, true);
    List<QueryFilter> subfilterList1 = Lists.newArrayList();
View Full Code Here

    ConcreteComparisonFilter lessOrEqualsFilter = new ConcreteComparisonFilter(
        ComparisonFilter.Operator.LE);
    ConcreteComparisonFilter greaterOrEqualsFilter =
        new ConcreteComparisonFilter(ComparisonFilter.Operator.GE);

    assertTrue(equalsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(123)));
    assertTrue(equalsFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abc")));
    assertTrue(equalsFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.TRUE));
    assertFalse(equalsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(345)));
    assertFalse(equalsFilter.isOperatorMatch(new TextValue("ab"),
        new TextValue("abc")));

    assertTrue(lessThanFilter.isOperatorMatch(new NumberValue(123.123),
        new NumberValue(123.124)));
    assertTrue(lessThanFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abd")));
    assertTrue(lessThanFilter.isOperatorMatch(BooleanValue.FALSE,
        BooleanValue.TRUE));
    assertFalse(lessThanFilter.isOperatorMatch(new NumberValue(7),
        new NumberValue(-14)));
    assertFalse(lessThanFilter.isOperatorMatch(new TextValue("bbb"),
        new TextValue("aaa")));
    assertFalse(lessThanFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.FALSE));

    assertTrue(lessOrEqualsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(123)));
    assertTrue(lessOrEqualsFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abc")));
    assertTrue(lessOrEqualsFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.TRUE));
    assertTrue(lessOrEqualsFilter.isOperatorMatch(new NumberValue(123.123),
        new NumberValue(123.124)));
    assertTrue(lessOrEqualsFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abd")));
    assertTrue(lessOrEqualsFilter.isOperatorMatch(BooleanValue.FALSE,
        BooleanValue.TRUE));
    assertFalse(lessOrEqualsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(122.2)));
    assertFalse(lessOrEqualsFilter.isOperatorMatch(new TextValue("ab"),
        new TextValue("aa")));
    assertFalse(lessOrEqualsFilter.isOperatorMatch(new NumberValue(7),
        new NumberValue(-14)));
    assertFalse(lessOrEqualsFilter.isOperatorMatch(new TextValue("bbb"),
        new TextValue("aaa")));
    assertFalse(lessOrEqualsFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.FALSE));

    assertFalse(notEqualsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(123)));
    assertFalse(notEqualsFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abc")));
    assertFalse(notEqualsFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.TRUE));
    assertTrue(notEqualsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(345)));
    assertTrue(notEqualsFilter.isOperatorMatch(new TextValue("ab"),
        new TextValue("abc")));

    assertFalse(greaterOrEqualsFilter.isOperatorMatch(new NumberValue(123.123),
        new NumberValue(123.124)));
    assertFalse(greaterOrEqualsFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abd")));
    assertFalse(greaterOrEqualsFilter.isOperatorMatch(BooleanValue.FALSE,
        BooleanValue.TRUE));
    assertTrue(greaterOrEqualsFilter.isOperatorMatch(new NumberValue(7),
        new NumberValue(-14)));
    assertTrue(greaterOrEqualsFilter.isOperatorMatch(new TextValue("bbb"),
        new TextValue("aaa")));
    assertTrue(greaterOrEqualsFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.FALSE));

    assertFalse(greaterThanFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(123)));
    assertFalse(greaterThanFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abc")));
    assertFalse(greaterThanFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.TRUE));
    assertFalse(greaterThanFilter.isOperatorMatch(new NumberValue(123.123),
        new NumberValue(123.124)));
    assertFalse(greaterThanFilter.isOperatorMatch(new TextValue("abc"),
        new TextValue("abd")));
    assertFalse(greaterThanFilter.isOperatorMatch(BooleanValue.FALSE,
        BooleanValue.TRUE));
    assertTrue(greaterThanFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(122.2)));
    assertTrue(greaterThanFilter.isOperatorMatch(new TextValue("ab"),
        new TextValue("aa")));
    assertTrue(greaterThanFilter.isOperatorMatch(new NumberValue(7),
        new NumberValue(-14)));
    assertTrue(greaterThanFilter.isOperatorMatch(new TextValue("bbb"),
        new TextValue("aaa")));
    assertTrue(greaterThanFilter.isOperatorMatch(BooleanValue.TRUE,
        BooleanValue.FALSE));

    // Test type mismatch:
    assertFalse(greaterThanFilter.isOperatorMatch(new TextValue("blah"),
        new NumberValue(123)));
    assertFalse(equalsFilter.isOperatorMatch(new DateValue(2000, 3, 3),
        BooleanValue.TRUE));
  }
View Full Code Here

    // Partial match:
    assertFalse(likeFilter.isOperatorMatch(new TextValue("blah blah"),
        new TextValue("bla%b%a")));

    // Test non-strings:
    assertTrue(containsFilter.isOperatorMatch(new NumberValue(123),
        new NumberValue(3)));
    assertTrue(containsFilter.isOperatorMatch(new NumberValue(123.45),
        new TextValue("23.4")));
    assertFalse(containsFilter.isOperatorMatch(new NumberValue(23423),
        BooleanValue.TRUE));

    assertTrue(startsWithFilter.isOperatorMatch(BooleanValue.FALSE,
        new TextValue("fa")));

    assertTrue(endsWithFilter.isOperatorMatch(new NumberValue(123.456),
        new TextValue("456")));

    assertTrue(matchesFilter.isOperatorMatch(new NumberValue(123),
        new TextValue(".*")));

    assertTrue(likeFilter.isOperatorMatch(new NumberValue(123),
        new TextValue("_2%")));
  }
View Full Code Here

    if (values.get(0).isNull() || values.get(1).isNull()) {
      return NumberValue.getNullValue();
    }
    double modulo = ((NumberValue) values.get(0)).getValue() %
        ((NumberValue) values.get(1)).getValue();
    return new NumberValue(modulo);
  }
View Full Code Here

    rows = Lists.newArrayList();

    TableRow row = new TableRow();
    row.addCell(new TableCell("aaa"));
    row.addCell(new TableCell(new NumberValue(222), "222"));
    row.addCell(new TableCell(false));
    rows.add(row);

    row = new TableRow();
    row.addCell(new TableCell(""));
View Full Code Here

    rows = Lists.newArrayList();

    TableRow row = new TableRow();
    row.addCell(new TableCell("aaa"));
    row.addCell(new TableCell(new NumberValue(222), "2a2b2"));
    rows.add(row);

    row = new TableRow();
    row.addCell(new TableCell(""));
    row.addCell(new TableCell(NumberValue.getNullValue()));
View Full Code Here

    rows = Lists.newArrayList();

    TableRow row = new TableRow();
    row.addCell(new TableCell(new TextValue("aaa"), "aaa"));
    row.addCell(new TableCell(new NumberValue(222), "222"));
    row.addCell(new TableCell(BooleanValue.TRUE, "true"));
    row.addCell(new TableCell(new DateValue(2009, 1, 1), "2009-02-01"));
    row.addCell(new TableCell(new DateTimeValue(2009, 1, 1, 12, 14, 1, 0), "2009-02-01 12:14:01"));
    row.addCell(new TableCell(new TimeOfDayValue(12, 14, 1), "12:14:01"));
    rows.add(row);
   
    row = new TableRow();
    row.addCell(new TableCell(new TextValue("aaa"), "a,aa"));
    row.addCell(new TableCell(new NumberValue(222), "2,22"));
    row.addCell(new TableCell(BooleanValue.TRUE, "true,"));
    row.addCell(new TableCell(new DateValue(2009, 1, 1), "2009-02-01"));
    row.addCell(new TableCell(new DateTimeValue(2009, 1, 1, 12, 14, 1, 0), "2009-02-01 12,14,01"));
    row.addCell(new TableCell(new TimeOfDayValue(12, 14, 1), "12:14:01"));
    rows.add(row);
View Full Code Here

  }

  public void testConstructorDouble() {
    TableCell cell = new TableCell(34.43);
    assertNotNull(cell);
    assertEquals(new NumberValue(34.43), cell.getValue());
  }
View Full Code Here

TOP

Related Classes of com.google.visualization.datasource.datatable.value.NumberValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.