Package wpn.hdri.ss.data

Examples of wpn.hdri.ss.data.Timestamp


    @Test
    public void testAddNull_NonNumeric() {
        Attribute<Boolean> attribute = new NonNumericAttribute<Boolean>(deviceName, name, "bool", Interpolation.LAST);

        attribute.addValue(timestamp, Value.getInstance(false), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(10)), Value.NULL, timestamp);

        Boolean result = attribute.getAttributeValue().getValue().get();
        assertNull(result);
    }
View Full Code Here


    @Test
    public void testGetTailValues() {
        Attribute<String> attribute = new NonNumericAttribute<String>(deviceName, name, "string", Interpolation.LAST);

        attribute.addValue(timestamp, Value.getInstance("Hello"), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(10)), Value.getInstance("World"), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(20)), Value.getInstance("!!!"), timestamp);

        Iterable<AttributeValue<String>> result = attribute.getAttributeValues(timestamp.add(new Timestamp(5)));

        String[] resultArray = Iterables.toArray(Iterables.transform(result, new Function<AttributeValue<String>, String>() {
            @Override
            public String apply(AttributeValue<String> input) {
                return input.getValue().get();
View Full Code Here

    @Test
    public void testArrayAttribute() {
        ArrayAttribute attribute = new ArrayAttribute(deviceName, name, "string");

        attribute.addValue(timestamp, Value.getInstance((Object) new double[]{0.D, 0.1D, 0.2D}), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(10)), Value.getInstance((Object) new double[]{0.1D, 0.2D, 0.3D}), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(20)), Value.getInstance((Object) new double[]{0.2D, 0.3D, 0.4D}), timestamp);

        AttributeValue<Object> value = attribute.getAttributeValue(timestamp.add(new Timestamp(15)));

        double[] result = (double[]) value.getValue().get();

        assertArrayEquals(new double[]{0.1D, 0.2D, 0.3D}, result, 0.0D);
    }
View Full Code Here

    @Test
    public void testStoreErase_Last() {
        Attribute<Double> attribute = new NumericAttribute<Double>(deviceName, name, Interpolation.LAST);

        attribute.addValue(timestamp, Value.getInstance(12.), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(10)), Value.getInstance(14.), timestamp);

        attribute.clear();


        Double result = attribute.getAttributeValue().getValue().get();
View Full Code Here

    @Test
    public void testStoreErase_All() {
        Attribute<Double> attribute = new NumericAttribute<Double>(deviceName, name, Interpolation.LAST);

        attribute.addValue(timestamp, Value.getInstance(12.), timestamp);
        attribute.addValue(timestamp.add(new Timestamp(10)), Value.getInstance(14.), timestamp);

        attribute.clear();

        assertTrue(Iterables.isEmpty(attribute.getAttributeValues(timestamp.add(new Timestamp(5)))));
    }
View Full Code Here

TOP

Related Classes of wpn.hdri.ss.data.Timestamp

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.