private Object[] executeAll(Object ctx, VariableResolverFactory vars) { if (length == 0) return GetterAccessor.EMPTY; Object[] vals = new Object[length]; for (int i = 0; i < length; i++) { vals[i] = parms[i].getValue(ctx, vars); } return vals; }
/** * Executes a compiled expression. * * @param compiledExpression - * @param factory - * @return - * @see #compileExpression(String) */ public static Object executeExpression(final Object compiledExpression, final VariableResolverFactory factory) { return ((ExecutableStatement) compiledExpression).getValue(null, factory); }
private Object[] executeAll(Object ctx, VariableResolverFactory vars) { if (length == 0) return GetterAccessor.EMPTY; Object[] vals = new Object[length]; for (int i = 0; i < length; i++) { vals[i] = parms[i].getValue( ctx, vars); } return vals; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory ctxFactory = indexAlloc ? factory : new MapVariableResolverFactory(new HashMap<String, Object>(1), factory); Object v; for (initializer.getValue(ctx, thisValue, ctxFactory); (Boolean) condition.getValue(ctx, thisValue, ctxFactory); after.getValue(ctx, thisValue, ctxFactory)) { v = compiledBlock.getValue(ctx, thisValue, ctxFactory); if (ctxFactory.tiltFlag()) return v; } return null; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory lc = new MapVariableResolverFactory(new HashMap(0), factory); do { compiledBlock.getValue(ctx, thisValue, lc); } while (!(Boolean) condition.getValue(ctx, thisValue, lc)); return null; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory ctxFactory = new MapVariableResolverFactory(new HashMap<String, Object>(0), factory); do { compiledBlock.getValue(ctx, thisValue, ctxFactory); } while ((Boolean) condition.getValue(ctx, thisValue, factory)); return null; }
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory ctxFactory = new MapVariableResolverFactory(new HashMap<String, Object>(0), factory); do { compiledBlock.getValue(ctx, thisValue, ctxFactory); } while ((Boolean) condition.getValue(ctx, thisValue, factory)); return null; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory ctxFactory = new MapVariableResolverFactory(new HashMap(0), factory); while (!(Boolean) condition.getValue(ctx, thisValue, factory)) { compiledBlock.getValue(ctx, thisValue, ctxFactory); } return null; }
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory lc = new MapVariableResolverFactory(new HashMap(0), factory); do { compiledBlock.getValue(ctx, thisValue, lc); } while (!(Boolean) condition.getValue(ctx, thisValue, lc)); return null; }
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolverFactory ctxFactory = new MapVariableResolverFactory(new HashMap<String, Object>(), factory); while ((Boolean) condition.getValue(ctx, thisValue, factory)) { compiledBlock.getValue(ctx, thisValue, ctxFactory); } return null; }
public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) { int[] s = new int[sizes.length]; for (int i = 0; i < s.length; i++) { s[i] = convert(sizes[i].getValue(ctx, elCtx, variableFactory), Integer.class); } return newInstance(arrayType, s); }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { if (statement == null) statement = (ExecutableStatement) subCompileExpression(expr, start, offset, pCtx); factory.createVariable(name, ctx = statement.getValue(ctx, thisValue, factory), egressType); return ctx; }
public Object processWith(Object ctx, Object thisValue, VariableResolverFactory factory) { for (WithNode.ParmValuePair pvp : withExpressions) { if (pvp.getSetExpression() != null) { executeSetExpression(pvp.getSetExpression(), ctx, factory, pvp.getStatement().getValue(ctx, thisValue, factory)); } else { pvp.getStatement().getValue(ctx, thisValue, factory); } } return ctx; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { if (statement == null) { statement = (ExecutableStatement) subCompileExpression(expr, this.start, this.offset, pCtx); acc = (CompiledAccExpression) compileSetExpression(property.toCharArray(), statement.getKnownEgressType(), pCtx); } acc.setValue(ctx, thisValue, factory, ctx = statement.getValue(ctx, thisValue, factory)); return ctx; }
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) { VariableResolver resolver = factory.getIndexedVariableResolver(register); resolver.setValue(ctx = MathProcessor.doOperations(resolver.getValue(), operation, statement.getValue(ctx, thisValue, factory))); return ctx; }
public ASTNode handleSubstatement(Substatement stmt) { if (stmt.getStatement() != null && stmt.getStatement().isLiteralOnly()) { return new LiteralNode(stmt.getStatement().getValue(null, null, null), pCtx); } else { return stmt; } }
public int doBefore(ASTNode node, VariableResolverFactory factory) { ((WithNode) node).getNestedStatement().getValue(null, factory); factory.createVariable("mod", "FOOBAR!"); return 0; }
public int doBefore(ASTNode node, VariableResolverFactory factory) { ((WithNode) node).getNestedStatement().getValue(null, factory); factory.createVariable("mod", "FOOBAR!"); return 0; }
public void testTestIntToLong() { String s = "1+(long)a"; ParserContext pc = new ParserContext(); pc.addInput("a", Integer.class); ExpressionCompiler compiler = new ExpressionCompiler(s, pc); CompiledExpression expr = compiler.compile(); Map vars = new HashMap(); vars.put("a", 1); Object r = ((ExecutableStatement) expr).getValue(null, new MapVariableResolverFactory(vars)); assertEquals(new Long(2), r); }