public static void addFunction(Map<Pair<QName, Integer>, Function> decls, String s) {
    final Pair<String, ? extends Function> pair = parseFuntionDeclaration(s);
    final Function func = pair.second;

    final boolean fn = pair.first.equals("fn") || pair.first.length() == 0;
    final boolean xs = pair.first.equals("xs");
    final Pair<QName, Integer> key = Pair.create(new QName(fn ? FUNCTION_NAMESPACE : (xs ? XPath2Type.XMLSCHEMA_NS : null), func.getName()), func.getParameters().length);
    assert !decls.containsKey(key) : key;

    decls.put(key, func);

    if (fn) {
      decls.put(Pair.create(new QName(null, func.getName()), func.getParameters().length), func);
    }
  }
public static void addFunction(Map<Pair<QName, Integer>, Function> decls, String s)