}
public Function lookupFunction(QualifiedName funcName, List<? extends XQExpression> params) {
// step1-1. bind java function.
if(funcName.getNamespaceURI().startsWith(JavaFunction.PROTOCOL)) {
JavaFunction func = new JavaFunction(funcName);
return func;
}
// step1-2. pre-defined functions lookup.
final int arity = params.size();
if(!XQueryConstants.LOCAL_URI.equals(funcName.getNamespaceURI())) {
BuiltInFunction func = PredefinedFunctions.lookup(funcName);
if(func != null) {
FunctionSignature[] sigs = func.getFunctionSignatures();
for(int i = 0; i < sigs.length; i++) {
if(sigs[i].getArity() == arity) {
return func;
}
}