Package com.googlecode.aviator.runtime.type

Examples of com.googlecode.aviator.runtime.type.AviatorObject


        Map<String, Object> env = new HashMap<String, Object>();
        env.putAll(AviatorEvaluator.FUNC_MAP);
        env.put("eq_temp_1", predicate);
        args[1] = new AviatorJavaType("eq_temp_1");
        SeqFilterFunction fun = new SeqFilterFunction();
        AviatorObject result = fun.call(env, args);
        Object[] array = (Object[]) result.getValue(null);
        assertEquals(1, array.length);
        for (Object i : array) {
            assertEquals("hello1", i);
        }
    }
View Full Code Here


        Map<String, Object> env = new HashMap<String, Object>();
        env.putAll(AviatorEvaluator.FUNC_MAP);
        env.put("eq_temp_1", predicate);
        args[1] = new AviatorJavaType("eq_temp_1");
        SeqFilterFunction fun = new SeqFilterFunction();
        AviatorObject result = fun.call(env, args);
        LinkedList list = (LinkedList) result.getValue(null);
        assertEquals(1, list.size());
        for (Object i : list) {
            assertEquals("hello1", i);
        }
    }
View Full Code Here

        args[0] = new AviatorRuntimeJavaType("hello");
        args[1] = new AviatorJavaType("string.length");
        SeqFilterFunction fun = new SeqFilterFunction();

        AviatorObject result = fun.call(AviatorEvaluator.FUNC_MAP, args);
    }
View Full Code Here

public class RandomFunctionUnitTest {

    @Test
    public void testCall() {
        RandomFunction rand = new RandomFunction();
        AviatorObject result = rand.call(null, new AviatorObject[0]);
        assertTrue(result instanceof AviatorDouble);
        assertFalse(result.getValue(null).equals(rand.call(null, new AviatorObject[0]).getValue(null)));
    }
View Full Code Here


    @Test(expected = IllegalArgumentException.class)
    public void testCallIllegalArgument() {
        RandomFunction rand = new RandomFunction();
        AviatorObject result = rand.call(null, new AviatorObject[2]);
    }
View Full Code Here

public class SysDateFunctionUnitTest {
    @Test
    public void testCall() {
        SysDateFunction fun = new SysDateFunction();

        AviatorObject result = fun.call(null);
        assertNotNull(result);
        assertTrue(result.getValue(null) instanceof Date);
    }
View Full Code Here

            strs[i] = "hello";
        }
        args[0] = new AviatorRuntimeJavaType(strs);
        args[1] = new AviatorJavaType("string.length");
        SeqMapFunction fun = new SeqMapFunction();
        AviatorObject result = fun.call(AviatorEvaluator.FUNC_MAP, args);
        Object[] array = (Object[]) result.getValue(null);
        for (Object i : array) {
            assertEquals(5, i);
        }
    }
View Full Code Here

            strs.add("hello");
        }
        args[0] = new AviatorRuntimeJavaType(strs);
        args[1] = new AviatorJavaType("string.length");
        SeqMapFunction fun = new SeqMapFunction();
        AviatorObject result = fun.call(AviatorEvaluator.FUNC_MAP, args);
        LinkedList array = (LinkedList) result.getValue(null);
        for (Object i : array) {
            assertEquals(5, i);
        }
    }
View Full Code Here

        args[0] = new AviatorRuntimeJavaType("hello");
        args[1] = new AviatorJavaType("string.length");
        SeqMapFunction fun = new SeqMapFunction();

        AviatorObject result = fun.call(AviatorEvaluator.FUNC_MAP, args);
    }
View Full Code Here

        args[0] = new AviatorRuntimeJavaType(a);
        args[1] = new AviatorJavaType("+");
        args[2] = new AviatorRuntimeJavaType(0);

        SeqReduceFunction fun = new SeqReduceFunction();
        AviatorObject result = fun.call(AviatorEvaluator.FUNC_MAP, args);
        assertNotNull(result);
        assertEquals(45, result.getValue(null));

    }
View Full Code Here

TOP

Related Classes of com.googlecode.aviator.runtime.type.AviatorObject

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.