/** * Simplify the arguments of the function. * Called from the simplify() method of each function. * * @param env the static context * @return the result of simplifying the arguments of the expression * @throws net.sf.saxon.trans.XPathException if an error occurs */ protected final Expression simplifyArguments(StaticContext env) throws XPathException { for (int i = 0; i < getArguments().length; i++) { Expression exp = getArg(i).simplify(); if (exp != getArg(i)) { adoptChildExpression(exp); setArg(i, exp); } } return this; }
/** * Simplify the arguments of the function. * Called from the simplify() method of each function. * * @param env the static context * @return the result of simplifying the arguments of the expression * @throws net.sf.saxon.trans.XPathException if an error occurs */ protected final Expression simplifyArguments(StaticContext env) throws XPathException { for (int i = 0; i < getArguments().length; i++) { Expression exp = getArg(i).simplify(); if (exp != getArg(i)) { adoptChildExpression(exp); setArg(i, exp); } } return this; }
public AbstractExpression exprFor (FunctionCall funcall) { if (funcall.getFunctionName().equals(itemAtQName)) { return new Subsequence(exprFor (funcall.getArguments()[0]), exprFor(funcall.getArguments()[1]), LiteralExpression.ONE); Expression arg = funcall.getArguments()[0]; if ((arg.getSpecialProperties() & StaticProperty.REVERSE_DOCUMENT_ORDER) != 0 || (! Cardinality.allowsMany(arg.getCardinality()))) { return new Subsequence (exprFor(funcall.getArguments()[0]), exprFor(funcall.getArguments()[1])); } else { if (funcall.getNumberOfArguments() != 3) { throw new LuxException ("call to subsequence has " + funcall.getNumberOfArguments() + " arguments?"); return new Subsequence (exprFor(funcall.getArguments()[0]), exprFor(funcall.getArguments()[1]), exprFor(funcall.getArguments()[2])); Expression[] args = funcall.getArguments(); AbstractExpression[] aargs = new AbstractExpression[args.length]; for (int i = 0; i < args.length; i++) {