Package org.apache.felix.gogo.runtime

Examples of org.apache.felix.gogo.runtime.Expression


        variables.put("c", 1l);
        variables.put("d", 2l);
        variables.put("s", " foo ");
        variables.put("t", "bar");

        assertEquals(4l, new Expression("c+=1, d+=2").eval(variables));

        assertEquals(" foo ", new Expression("\" foo \"").eval());
        assertEquals(" foo bar", new Expression("s + t").eval(variables));
        assertEquals(1l, new Expression("s < t").eval(variables));
        assertEquals(1l, new Expression("s > t || t == \"bar\"").eval(variables));

        assertEquals(3l, new Expression("a += 1").eval(variables));
        assertEquals(3l, variables.get("a"));

        assertEquals(30l, new Expression("10 + 20 | 30").eval());

        assertEquals(8l, new Expression("a + b").eval(variables));
        assertEquals(3l, new Expression("if(a < b, a, b)").eval(variables));

        assertEquals(16l, new Expression("2 + 2 << 2").eval());
        assertEquals(8l, new Expression("2 | 2 << 2").eval());
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.gogo.runtime.Expression

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.