Examples of AviatorJavaType


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

            a.add(i);
        }

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

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

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

        Map<String, Object> env = new HashMap<String, Object>();
        env.put("a", 10000);
        env.put("b", 9.0);

        assertEquals(Math.cos(10000), this.function.call(env, new AviatorJavaType("a")).getValue(null));
        assertEquals(Math.cos(9.0), this.function.call(env, new AviatorJavaType("b")).getValue(null));
    }
View Full Code Here

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

    @Test(expected = IllegalArgumentException.class)
    public void testReduce_String() {

        AviatorObject[] args = new AviatorObject[3];
        args[0] = new AviatorRuntimeJavaType("hello");
        args[1] = new AviatorJavaType("+");
        args[2] = new AviatorRuntimeJavaType(0);

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

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

        Map<String, Object> env = new HashMap<String, Object>();
        env.put("a", 3.0);
        env.put("b", 9.0);

        assertEquals(Math.pow(3.0, 9.0), this.function.call(env, new AviatorJavaType("a"), new AviatorJavaType("b"))
            .getValue(null));
        assertEquals(Math.pow(9.0, 4), this.function.call(env, new AviatorJavaType("b"), AviatorNumber.valueOf(4))
            .getValue(null));
        assertEquals(Math.pow(-2.3, 3.0), this.function
            .call(env, AviatorNumber.valueOf(-2.3), new AviatorJavaType("a")).getValue(null));
    }
View Full Code Here

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

        Map<String, Object> env = new HashMap<String, Object>();
        env.put("a", 10000);
        env.put("b", 9.0);

        assertEquals(4.0, this.function.call(env, new AviatorJavaType("a")).getValue(null));
        assertEquals(0.9542, this.function.call(env, new AviatorJavaType("b")).getValue(null));
    }
View Full Code Here

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

        Map<String, Object> env = new HashMap<String, Object>();
        env.put("a", 400);
        env.put("b", 9.0);

        assertEquals(20.0, this.function.call(env, new AviatorJavaType("a")).getValue(null));
        assertEquals(3.0, this.function.call(env, new AviatorJavaType("b")).getValue(null));
    }
View Full Code Here

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

        Map<String, Object> env = new HashMap<String, Object>();
        env.put("a", 10000);
        env.put("b", 9.0);

        assertEquals(Math.tan(10000), this.function.call(env, new AviatorJavaType("a")).getValue(null));
        assertEquals(Math.tan(9.0), this.function.call(env, new AviatorJavaType("b")).getValue(null));
    }
View Full Code Here

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

    @Test
    public void testGetFunction_Normal() {

        AviatorObject[] args = new AviatorObject[1];
        args[0] = new AviatorJavaType("map");
        AviatorFunction fun = FunctionUtils.getFunction(0, args, AviatorEvaluator.FUNC_MAP, 2);
        assertNotNull(fun);
        assertTrue(fun instanceof SeqMapFunction);
    }
View Full Code Here

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


    @Test
    public void testGetFunction_sub() {
        AviatorObject[] args = new AviatorObject[1];
        args[0] = new AviatorJavaType("-");
        AviatorFunction fun = FunctionUtils.getFunction(0, args, AviatorEvaluator.FUNC_MAP, 2);
        assertNotNull(fun);
        assertTrue(fun instanceof BinaryFunction);
        assertEquals("-sub", fun.getName());
        assertEquals(OperatorType.SUB, ((BinaryFunction) fun).getOpType());
View Full Code Here

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


    @Test
    public void testGetFunction_neg() {
        AviatorObject[] args = new AviatorObject[1];
        args[0] = new AviatorJavaType("-");
        AviatorFunction fun = FunctionUtils.getFunction(0, args, AviatorEvaluator.FUNC_MAP, 1);
        assertNotNull(fun);
        assertTrue(fun instanceof BinaryFunction);
        assertEquals("-neg", fun.getName());
        assertEquals(OperatorType.NEG, ((BinaryFunction) fun).getOpType());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.