/** * Create an ASTJexlScript with the provided child * * @param child * @return */ public static ASTJexlScript createScript(JexlNode child) { ASTJexlScript script = new ASTJexlScript(ParserTreeConstants.JJTJEXLSCRIPT); // Wrap the child in parens to be sure we don't misconstrue the intent // of the query JexlNode wrappedChild = wrap(child); script.jjtAddChild(wrappedChild, 0); wrappedChild.jjtSetParent(script); return script; }
newNode.jjtAddChild(newChild, newIndex); newIndex++; newNode.jjtAddChild(newChild, newIndex); newIndex++;
@Override public Object visit(ASTJexlScript node, Object data) { setPushDown((PushDownVisitor) data); costEstimator = new CostEstimator(parentVisitor); if (log.isTraceEnabled()) log.trace("Setting cost estimator"); // don't rewrite yet ASTJexlScript newScript = new ASTJexlScript(ParserTreeConstants.JJTJEXLSCRIPT); // for this to work we should only have a single child Preconditions.checkArgument(node.jjtGetNumChildren() == 1); JexlNode child = node.jjtGetChild(0); if (ASTDelayedPredicate.instanceOf(child)) { child = child.jjtGetChild(0); child = (JexlNode) child.jjtAccept(this, data); child.jjtSetParent(newScript); newScript.jjtAddChild(child, 0); return newScript; } else return node; }
node.jjtAddChild(newChild, newIndex); newIndex++; node.jjtAddChild(newChild, newIndex); newIndex++; node.jjtAddChild(newChild, newIndex); newIndex++;
node.jjtAddChild(newChild, newIndex); newIndex++; node.jjtAddChild(newChild, newIndex); newIndex++; node.jjtAddChild(newChild, newIndex); newIndex++;