public Sequence[] evaluateArguments(XPathContext context) throws XPathException { int numArgs = getArity(); Sequence[] actualArgs = new Sequence[numArgs]; for (int i = 0; i < numArgs; i++) { actualArgs[i] = ExpressionTool.lazyEvaluate(getArg(i), context, false); } return actualArgs; }
/** * Produce a short string identifying the expression for use in error messages * * @return a short string, sufficient to identify the expression */ @Override public String toShortString() { StructuredQName fName = getFunctionName(); return (fName == null ? "$anonFn" : fName.getDisplayName()) + "(" + (getArity() == 0 ? "" : "...") + ")"; }
/** * Produce a short string identifying the expression for use in error messages * * @return a short string, sufficient to identify the expression */ @Override public String toShortString() { StructuredQName fName = getFunctionName(); return (fName == null ? "$anonFn" : fName.getDisplayName()) + "(" + (getArity() == 0 ? "" : "...") + ")"; }
public Sequence[] evaluateArguments(XPathContext context) throws XPathException { int numArgs = getArity(); Sequence[] actualArgs = new Sequence[numArgs]; for (int i = 0; i < numArgs; i++) { actualArgs[i] = ExpressionTool.lazyEvaluate(getArg(i), context, false); } return actualArgs; }
/** * Get the expressions supplied as actual arguments to the function * * @return the array of expressions supplied in the argument list of the function call. The array * is newly constructed to ensure that modifications to the array have no effect. */ public Expression[] getArguments() { Expression[] result = new Expression[getArity()]; int i=0; for (Operand o : operands()) { result[i++] = o.getChildExpression(); } return result; }
/** * Get the expressions supplied as actual arguments to the function * * @return the array of expressions supplied in the argument list of the function call. The array * is newly constructed to ensure that modifications to the array have no effect. */ public Expression[] getArguments() { Expression[] result = new Expression[getArity()]; int i=0; for (Operand o : operands()) { result[i++] = o.getChildExpression(); } return result; }
/** * Determine whether two expressions are equivalent */ public boolean equals(Object o) { if (!(o instanceof FunctionCall)) { return false; } if (getFunctionName() == null) { return this == o; } FunctionCall f = (FunctionCall) o; if (!getFunctionName().equals(f.getFunctionName())) { return false; } if (getArity() != f.getArity()) { return false; } for (int i = 0; i < getArity(); i++) { if (!getArg(i).isEqual(f.getArg(i))) { return false; } } return true; }
/** * Determine whether two expressions are equivalent */ public boolean equals(Object o) { if (!(o instanceof FunctionCall)) { return false; } if (getFunctionName() == null) { return this == o; } FunctionCall f = (FunctionCall) o; if (!getFunctionName().equals(f.getFunctionName())) { return false; } if (getArity() != f.getArity()) { return false; } for (int i = 0; i < getArity(); i++) { if (!getArg(i).isEqual(f.getArg(i))) { return false; } } return true; }
/** * Get hashCode in support of equals() method */ public int computeHashCode() { if (getFunctionName() == null) { return super.computeHashCode(); } int h = getFunctionName().hashCode(); for (int i = 0; i < getArity(); i++) { h ^= getArg(i).hashCode(); } return h; }
/** * Get hashCode in support of equals() method */ public int computeHashCode() { if (getFunctionName() == null) { return super.computeHashCode(); } int h = getFunctionName().hashCode(); for (int i = 0; i < getArity(); i++) { h ^= getArg(i).hashCode(); } return h; }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max) throws XPathException { int numArgs = getArity(); String msg = null; if (min == max && numArgs != min) { msg = "Function " + getDisplayName() + " must have " + pluralArguments(min); } else if (numArgs < min) { msg = "Function " + getDisplayName() + " must have at least " + pluralArguments(min); } else if (numArgs > max) { msg = "Function " + getDisplayName() + " must have no more than " + pluralArguments(max); } if (msg != null) { XPathException err = new XPathException(msg, "XPST0017"); err.setIsStaticError(true); err.setLocation(getLocation()); throw err; } return numArgs; }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max) throws XPathException { int numArgs = getArity(); String msg = null; if (min == max && numArgs != min) { msg = "Function " + getDisplayName() + " must have " + pluralArguments(min); } else if (numArgs < min) { msg = "Function " + getDisplayName() + " must have at least " + pluralArguments(min); } else if (numArgs > max) { msg = "Function " + getDisplayName() + " must have no more than " + pluralArguments(max); } if (msg != null) { XPathException err = new XPathException(msg, "XPST0017"); err.setIsStaticError(true); err.setLocation(getLocation()); throw err; } return numArgs; }