@Test public void test1 () throws Exception { Globals globals = new Globals (); JaqyInterpreter interpreter = new JaqyInterpreter (globals, null, null); VariableManager vm = interpreter.getVariableManager (); ExpNode exp; exp = WhereParser.getExp ("1"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (1), exp.get ()); exp = WhereParser.getExp ("1--1"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (2), exp.get ()); exp = WhereParser.getExp ("1-1"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (0), exp.get ()); exp = WhereParser.getExp ("1 + 2 * 3 % 5 * 2 / 1"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (3), exp.get ()); exp = WhereParser.getExp ("-1 + 2 * 3 % 5 * -2.125 - 2"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Double (-5.125), exp.get ()); exp = WhereParser.getExp ("4 & 8 | 3"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (3), exp.get ()); exp = WhereParser.getExp ("1 ^ 2"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (3), exp.get ()); exp = WhereParser.getExp ("~2"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Integer (-3), exp.get ()); exp = WhereParser.getExp ("'abc'"); exp.bind (null, vm, interpreter); Assert.assertEquals ("abc", exp.get ()); exp = WhereParser.getExp ("1 < 2"); exp.bind (null, vm, interpreter); Assert.assertTrue ((Boolean)exp.get ()); exp = WhereParser.getExp ("1 <= (2)"); exp.bind (null, vm, interpreter); Assert.assertTrue ((Boolean)exp.get ()); exp = WhereParser.getExp ("1 = 2"); exp.bind (null, vm, interpreter); Assert.assertFalse ((Boolean)exp.get ()); exp = WhereParser.getExp ("1 <> 2"); exp.bind (null, vm, interpreter); Assert.assertTrue ((Boolean)exp.get ()); exp = WhereParser.getExp ("1 > 2"); exp.bind (null, vm, interpreter); Assert.assertFalse ((Boolean)exp.get ()); exp = WhereParser.getExp ("1 >= 2"); exp.bind (null, vm, interpreter); Assert.assertFalse ((Boolean)exp.get ()); exp = WhereParser.getExp ("Math.sqrt(4)"); exp.bind (null, vm, interpreter); Assert.assertEquals (new Double (2), exp.get ()); exp = WhereParser.getExp ("Math.random()"); exp.bind (null, vm, interpreter); Assert.assertEquals (Double.class, exp.get ().getClass ()); exp = WhereParser.getExp ("1 || 2"); exp.bind (null, vm, interpreter); Assert.assertEquals ("12", exp.get ()); exp = WhereParser.getExp ("'abc' || 2"); exp.bind (null, vm, interpreter); Assert.assertEquals ("abc2", exp.get ()); exp = WhereParser.getExp ("'abc' || 1 || 2"); exp.bind (null, vm, interpreter); Assert.assertEquals ("abc12", exp.get ()); }
public ExpNode getExp () { return m_exp; }
WhereParser extends GeneratedWhereParser { public ExpNode getExp () { return m_exp; } }
WhereParser extends GeneratedWhereParser { public ExpNode getExp () { return m_exp; } private  WhereParser(); }
WhereParser extends GeneratedWhereParser { public ExpNode getExp () { return m_exp; } private  WhereParser(); ExpNode getExp(); static ExpNode getExp(String str); }
WhereParser extends GeneratedWhereParser { public ExpNode getExp () { return m_exp; } private  WhereParser(); ExpNode getExp(); static ExpNode getExp(String str);  }