Package org.pirkaengine.core.expression

Examples of org.pirkaengine.core.expression.Function


     */
    Invocable getInvocable(Function function) throws ScriptException {
        assert function != null;
        assert function.language != null;
        synchronized (this.functions) {
            Function registeredFunc = this.functions.get(function.language);
            if (registeredFunc == null || !registeredFunc.equals(function)) {
                eval(function);
            }
            return (Invocable) getEngine();
        }
    }
View Full Code Here


    public void setup() {
        target = new FunctionEngine(ExpressionEngine.getInstance());
        script = "foo(hoge)";
        model = new HashMap<String, Object>();
        functions = new HashMap<String, Function>();
        functions.put("bar", new Function(null, "return 0;", "bar"));
    }
View Full Code Here

public class FunctionTest {

    @Test
    public void create_one_param() {
        Function actual = ScriptFunction.create("javascript", "hoge(foo)", "return 0;");
        Function expected = new Function("javascript", "return 0;", "hoge", new String[] { "foo" });
        assertEquals(expected, actual);
    }
View Full Code Here

        assertEquals(expected, actual);
    }

    @Test
    public void create_two_params() {
        Function actual = ScriptFunction.create("javascript", "hoge(foo,bar)", "return 0;");
        Function expected = new Function("javascript", "return 0;", "hoge", new String[] { "foo", "bar" });
        assertEquals(expected, actual);
    }
View Full Code Here

        assertEquals(expected, actual);
    }

    @Test
    public void create_no_params() {
        Function actual = ScriptFunction.create("groovy", "huga()", "return 1;");
        Function expected = new Function("groovy", "return 1;", "huga");
        assertEquals(expected, actual);
    }
View Full Code Here

    }

    @Test
    public void equals_true() {
        ScriptFunction func = ScriptFunction.create("groovy", "huga()", "return 1;");
        Function func2 = ScriptFunction.create("groovy", "huga()", "return 1;");
        assertEquals(func.hashCode(), func2.hashCode());
        assertTrue(func.equals(func2));
    }
View Full Code Here

TOP

Related Classes of org.pirkaengine.core.expression.Function

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.