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

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


        row.addCell(new TableCell(NumberValue.getNullValue()));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new TextValue("bbb"), "bbb"));
        row.addCell(new TableCell(333));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
View Full Code Here


        row.addCell(new TableCell(111));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell((new TextValue("bbb")), "bbb"));
        row.addCell(new TableCell(333));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
View Full Code Here

        selection.addColumn(new AggregationColumn(new SimpleColumn("B"), AggregationType.MAX));
        q.setSelection(selection);
        QuerySort sort = new QuerySort();
        sort.addSort(new ColumnSort(new SimpleColumn("A"), SortOrder.DESCENDING));
        q.setSort(sort);
        QueryFilter filter = new ColumnValueFilter(new SimpleColumn("A"), new TextValue("foo"),
                ComparisonFilter.Operator.GT);
        q.setFilter(filter);
        q.setRowLimit(7);
        q.setRowOffset(17);
        QueryLabels labels = new QueryLabels();
View Full Code Here

    /**
     * @param values A list that contains one text value.
     * @return An uppercase version of the input text value.
     */
    public Value evaluate(List<Value> values) {
        return new TextValue(((TextValue) values.get(0)).getValue().toUpperCase());
    }
View Full Code Here

        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

        ConcreteComparisonFilter matchesFilter = new ConcreteComparisonFilter(
                ComparisonFilter.Operator.MATCHES);
        ConcreteComparisonFilter likeFilter = new ConcreteComparisonFilter(
                ComparisonFilter.Operator.LIKE);

        assertTrue(containsFilter.isOperatorMatch(new TextValue("blah blah"),
                new TextValue("ah bl")));
        assertTrue(containsFilter.isOperatorMatch(new TextValue("foo bar"),
                new TextValue("foo ")));
        assertTrue(containsFilter.isOperatorMatch(new TextValue("foo bar"),
                new TextValue(" bar")));
        assertFalse(containsFilter.isOperatorMatch(new TextValue("abc123"),
                new TextValue("bd")));

        assertTrue(startsWithFilter.isOperatorMatch(new TextValue("this is a " +
                "text value"), new TextValue("this is")));
        assertFalse(startsWithFilter.isOperatorMatch(new TextValue("foo bar"),
                new TextValue("oo bar")));

        assertTrue(endsWithFilter.isOperatorMatch(new TextValue("this is a " +
                "text value"), new TextValue("text value")));
        assertFalse(endsWithFilter.isOperatorMatch(new TextValue("foo bar"),
                new TextValue("foo ba")));

        assertTrue(matchesFilter.isOperatorMatch(new TextValue("aaaaaa123"),
                new TextValue("a*123")));
        assertTrue(matchesFilter.isOperatorMatch(new TextValue("abcdefghijk"),
                new TextValue("[a-k]+")));
        assertFalse(matchesFilter.isOperatorMatch(new TextValue("abc1234"),
                new TextValue("a*123")));
        assertFalse(matchesFilter.isOperatorMatch(new TextValue("blah blah"),
                new TextValue("%^@%!%$#^*&*$!@#$((((")));
        // Test partial
        assertFalse(matchesFilter.isOperatorMatch(new TextValue("aaaaaaa123"),
                new TextValue("a*")));

        assertTrue(likeFilter.isOperatorMatch(new TextValue("aaaabbbccc"),
                new TextValue("a%b_b%c")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("aaaabbbccc"),
                new TextValue("aaqqb_c%c")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("aaaabbbccc"),
                new TextValue("a%%b_b%c")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("aaaabbbccc"),
                new TextValue("%")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foo bar"),
                new TextValue("foo_bar")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foo%bar"),
                new TextValue("foo_bar")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("blah blah"),
                new TextValue("bla%b%aa")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foobar"),
                new TextValue("foo__r")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("foobr"),
                new TextValue("foo__r")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("foobaar"),
                new TextValue("foo__r")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foobaar"),
                new TextValue("foo__%_r")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foobaaar"),
                new TextValue("foo__%_r")));
        assertTrue(likeFilter.isOperatorMatch(new TextValue("foobaaaar"),
                new TextValue("foo__%_r")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("foobar"),
                new TextValue("foo__%_r")));
        assertFalse(likeFilter.isOperatorMatch(new TextValue("foobr"),
                new TextValue("foo__%_r")));

        // 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

        row.addCell(new TableCell(NumberValue.getNullValue()));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new TextValue("bbb"), "bbb"));
        row.addCell(new TableCell(333));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
View Full Code Here

        row.addCell(new TableCell(111));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell((new TextValue("bbb")), "bbb"));
        row.addCell(new TableCell(333));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
View Full Code Here

    /**
     * @param values A list that contains one text value.
     * @return A lower-case version of the input text value.
     */
    public Value evaluate(List<Value> values) {
        return new TextValue(((TextValue) values.get(0)).getValue().toLowerCase());
    }
View Full Code Here

        row.addCell(NumberValue.getNullValue());
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new TextValue("bbb"), "bb@@b"));
        row.addCell(new TableCell(333));
        row.addCell(new TableCell(true));
        rows.add(row);

        row = new TableRow();
View Full Code Here

TOP

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

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.