Exemple #1
0
 public Comparable<?>[] evaluate(ASTFunNode node, JepRuntime runtime) throws ParseException {
   node.childrenAccept(runtime.ev, null);
   int num = node.jjtGetNumChildren();
   if (num == 1) {
     Comparable<?> param1 = runtime.stack.pop();
     return new Comparable<?>[] {param1};
   } else if (num == 2) {
     Comparable<?> param2 = runtime.stack.pop();
     Comparable<?> param1 = runtime.stack.pop();
     return new Comparable<?>[] {param1, param2};
   } else {
     // remove all parameters from stack and push null
     removeParams(runtime.stack, num);
     throw new ParseException(PARAMS_NUMBER + " for trunc");
   }
 }
 public Comparable<?>[] evaluate(ASTFunNode node, JepRuntime runtime) throws ParseException {
   node.childrenAccept(runtime.ev, null);
   Comparable<?> param = runtime.stack.pop();
   return new Comparable<?>[] {param};
 }