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

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


        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);

        testData.addRows(rows);

        String expected = "\"col0\",\"col1\",\"col2\",\"col3\",\"col4\",\"col5\"\n";
View Full Code Here


        TableRow row = new TableRow();
        row.addCell(new TableCell("aaa"));
        row.addCell(new TableCell(222));
        row.addCell(new TableCell(false));
        row.addCell(new TableCell(new DateValue(2001, 10, 14)));
        row.addCell(new TableCell(new TimeOfDayValue(12, 11, 13, 14)));
        row.addCell(new TableCell(new DateTimeValue(2000, 10, 1, 1, 10, 23, 432)));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new TextValue("ccc"), "$ccc"));
        row.addCell(new TableCell(111));
        row.addCell(new TableCell(true));
        row.addCell(new TableCell(new DateValue(2001, 1, 14)));
        row.addCell(new TableCell(new TimeOfDayValue(12, 30, 13, 14)));
        row.addCell(new TableCell(new DateTimeValue(1000, 11, 1, 1, 10, 23, 432)));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell("bbb"));
        row.addCell(new TableCell(3));
        row.addCell(new TableCell(true));
        row.addCell(new TableCell(new DateValue(2012, 2, 14)));
        row.addCell(new TableCell(new TimeOfDayValue(12, 11, 3, 14)));
        row.addCell(new TableCell(new DateTimeValue(2000, 1, 1, 1, 10, 31, 4)));
        rows.add(row);

        row = new TableRow();
        row.addCell("ddd");
        row.addCell(222);
        row.addCell(false);
        row.addCell(new DateValue(1997, 5, 5));
        row.addCell(new TimeOfDayValue(12, 15, 15, 14));
        row.addCell(new DateTimeValue(3100, 1, 2, 15, 15, 1, 0));
        rows.add(row);

        testData.addRows(rows);
    }
View Full Code Here

        assertEquals(5, testData.getNumberOfRows());
        assertEquals(testData.getRow(4).getCell(0).getValue().compareTo(new TextValue("blah")), 0);
        assertEquals(testData.getRow(4).getCell(1).getValue().compareTo(new NumberValue(5)), 0);
        assertEquals(testData.getRow(4).getCell(2).getValue().compareTo(BooleanValue.TRUE), 0);
        assertEquals(testData.getRow(4).getCell(3).getValue().compareTo(new DateValue(c1)), 0);
        assertEquals(testData.getRow(4).getCell(4).getValue().compareTo(new TimeOfDayValue(c2)), 0);
        assertEquals(testData.getRow(4).getCell(5).getValue().compareTo(new DateTimeValue(c2)), 0);
    }
View Full Code Here

        // If time is null it is handled later.
        if (time != null) {
          GregorianCalendar gc =
              new GregorianCalendar(TimeZone.getTimeZone("GMT"));
          gc.setTime(time);
          value = new TimeOfDayValue(gc);
        }
        break;
      default:
        String colValue = rs.getString(column);
        if (colValue == null) {
View Full Code Here

                    log.error(String.format(timeOfDayMessage, s));
                    throw new InvalidQueryException(String.format(timeOfDayMessage, s));
                }
                second = Integer.parseInt(secondMilliSplit[0]);
                int milli = Integer.parseInt(secondMilliSplit[1]);
                return new TimeOfDayValue(hour, minute, second, milli);
            }
            else {
                second = Integer.parseInt(split[2]);
                return new TimeOfDayValue(hour, minute, second);
            }
        }
        catch(NumberFormatException e) {
            log.error(String.format(timeOfDayMessage, s));
            throw new InvalidQueryException(String.format(timeOfDayMessage, s));
View Full Code Here

                    uFormat.format(new DateValue(1995, 7, 3).getObjectToFormat());
                    break;
                case TIMEOFDAY:
                    uFormat = new SimpleDateFormat(pattern, locale);
                    ((SimpleDateFormat) uFormat).setTimeZone(TimeZone.getTimeZone("GMT"));
                    uFormat.format(new TimeOfDayValue(2, 59, 12, 123).getObjectToFormat());
                    break;
                case DATETIME:
                    uFormat = new SimpleDateFormat(pattern, locale);
                    ((SimpleDateFormat) uFormat).setTimeZone(TimeZone.getTimeZone("GMT"));
                    uFormat.format(new DateTimeValue(1995, 7, 3, 2, 59, 12, 123).getObjectToFormat());
View Full Code Here

     */
    private TimeOfDayValue parseTimeOfDay(String val) throws ParseException {
        Date date = ((SimpleDateFormat) uFormat).parse(val);
        GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
        gc.setTime(date);
        return new TimeOfDayValue(gc);
    }
View Full Code Here

        query = QueryBuilder.getInstance().parseQuery(
                "WHERE c1 = timesTaMP '2007-01-30 15:33:22.432'");
        assertEquals(new DateTimeValue(2007, 0, 30, 15, 33, 22, 432),
                ((ColumnValueFilter) query.getFilter()).getValue());
        query = QueryBuilder.getInstance().parseQuery("WHERE c1 != TimeOfDay '15:33:22'");
        assertEquals(new TimeOfDayValue(15, 33, 22),
                ((ColumnValueFilter) query.getFilter()).getValue());
    }
View Full Code Here

    public void testReadWithLocale() throws IOException, CsvDataSourceException {
        List<ColumnDescription> columnDescriptions = Lists.newArrayList();
        columnDescriptions.add(new ColumnDescription("A", ValueType.NUMBER, "A"));
        columnDescriptions.add(new ColumnDescription("B", ValueType.TIMEOFDAY, "B"));
        TimeOfDayValue hindiTimeOfDayValue = new TimeOfDayValue(1, 12, 1);
        String hindiTimeOfDayString = "\u0966\u0967\u003a\u0967\u0968\u003a\u0966\u0967";
        Reader reader = new StringReader("1," + hindiTimeOfDayString);
        DataTable dataTable = CsvDataSourceHelper.read(reader, columnDescriptions, false,
                new ULocale("hi_IN"));
        assertEquals(1, dataTable.getNumberOfRows());
View Full Code Here

        assertEquals(new NumberValue(12), minute.evaluate(dateTimeValues));
        assertEquals(new NumberValue(22), second.evaluate(dateTimeValues));
        assertEquals(new NumberValue(333), millisecond.evaluate(dateTimeValues));

        List<Value> timeOfDayValues =
                Lists.newArrayList((Value) new TimeOfDayValue(23, 22, 21, 20));
        assertEquals(new NumberValue(23), hour.evaluate(timeOfDayValues));
        assertEquals(new NumberValue(22), minute.evaluate(timeOfDayValues));
        assertEquals(new NumberValue(21), second.evaluate(timeOfDayValues));
        assertEquals(new NumberValue(20), millisecond.evaluate(timeOfDayValues));
        timeOfDayValues = Lists.newArrayList((Value) new TimeOfDayValue(9, 12, 22));
        // Tests that milliseconds return 0 when the the TimeOfDayValue is
        // initialized without the milliseconds.
        assertEquals(new NumberValue(0), millisecond.evaluate(timeOfDayValues));

        List<Value> dateValues1 =
View Full Code Here

TOP

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

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.