Package net.sf.saxon.expr

Examples of net.sf.saxon.expr.UserFunctionCall$FunctionCallPackage


            return null;
        }
        if (fn.isOverriding() != overriding) {
            return null;
        }
        UserFunctionCall fc = new UserFunctionCall();
        fn.registerReference(fc);
        fc.setFunctionName(functionName);
        fc.setArguments(staticArgs);
        fc.setConfirmed(true);
        return fc;
    }
View Full Code Here


        UserFunction fn = functions.get(makeKey(functionName, staticArgs.length));
        if (fn == null) {
            return null;
        }
        ExpressionVisitor visitor = ExpressionVisitor.make(env);
        UserFunctionCall fc = new UserFunctionCall();
        fc.setFunctionName(functionName);
        fc.setArguments(staticArgs);
        fc.setFunction(fn);
        fc.checkFunctionCall(fn, visitor);
        fc.setStaticType(fn.getResultType(config.getTypeHierarchy()));
        return fc;
    }
View Full Code Here

//            return next();
//        }
        //System.err.println("Construct: " + construct);
        if (construct == Location.FUNCTION_CALL) {
            ContextStackFrame.FunctionCall sf = new ContextStackFrame.FunctionCall();
            UserFunctionCall ufc = (UserFunctionCall)origin;
            sf.setSystemId(ufc.getSystemId());
            sf.setLineNumber(ufc.getLineNumber());
            sf.setContainer(ufc.getContainer());
            sf.setFunctionName(ufc.getFunctionName());
            sf.setContextItem(context.getContextItem());
            next = context.getCaller();
            return sf;
        } else if (construct == StandardNames.XSL_APPLY_TEMPLATES) {
            ContextStackFrame.ApplyTemplates sf = new ContextStackFrame.ApplyTemplates();
View Full Code Here

    public Expression bind(StructuredQName functionName, Expression[] arguments, StaticContext env) throws XPathException {
        String functionKey = XQueryFunction.getIdentificationKey(
                functionName, arguments.length);
        XQueryFunction fd = functions.get(functionKey);
        if (fd != null) {
            UserFunctionCall ufc = new UserFunctionCall();
            ufc.setFunctionName(fd.getFunctionName());
            ufc.setArguments(arguments);
            ufc.setStaticType(fd.getResultType());
            UserFunction fn = fd.getUserFunction();
            if (fn == null) {
                // not yet compiled
                fd.registerReference(ufc);
                ufc.setConfirmed(true);
            } else {
                ufc.setFunction(fn);
                ExpressionVisitor visitor = ExpressionVisitor.make(fd.getStaticContext());
                visitor.setExecutable(fd.getExecutable());
                ufc.checkFunctionCall(fn, visitor);
            }
            return ufc;
        } else {
            return null;
        }
View Full Code Here

    public Expression bind(StructuredQName functionName, Expression[] arguments, StaticContext env) throws XPathException {
        if (resolving) {
            return null;
        }
        UserFunctionCall ufc = new UserFunctionCall();
        ufc.setFunctionName(functionName);
        ufc.setArguments(arguments);
        unboundFunctionCalls.add(ufc);
        correspondingStaticContext.add(env);
        return ufc;
    }
View Full Code Here

     */

    public void bindUnboundFunctionCalls(XQueryFunctionBinder lib, Configuration config) throws XPathException {
        resolving = true;
        for (int i=0; i<unboundFunctionCalls.size(); i++) {
            UserFunctionCall ufc = (UserFunctionCall)unboundFunctionCalls.get(i);
            QueryModule importingModule = (QueryModule)correspondingStaticContext.get(i);
            correspondingStaticContext.set(i, null);    // for garbage collection purposes
            // The original UserFunctionCall is effectively a dummy: we weren't able to find a function
            // definition at the time. So we try again.
            final StructuredQName q = ufc.getFunctionName();
            final int arity = ufc.getNumberOfArguments();

            XQueryFunction fd = lib.getDeclaration(q, ufc.getArguments());
            if (fd != null) {
                fd.registerReference(ufc);
                ufc.setStaticType(fd.getResultType());
                ufc.setConfirmed(true);
                // Check that the result type and all the argument types are in the static context of the
                // calling module
                importingModule.checkImportedFunctionSignature(fd);
            } else {
                String msg = "Cannot find a matching " + arity +
View Full Code Here

            return null;
        }
        if (fn.isOverriding() != overriding) {
            return null;
        }
        UserFunctionCall fc = new UserFunctionCall();
        fn.registerReference(fc);
        fc.setFunctionNameCode(nameCode);
        fc.setArguments(staticArgs);
        fc.setConfirmed(true);
        return fc;
    }
View Full Code Here

        UserFunction fn = (UserFunction)functions.get(new Long(key));
        if (fn == null) {
            return null;
        }
        StandaloneContext env = new StandaloneContext(config); // this is needed only for the name pool
        UserFunctionCall fc = new UserFunctionCall();
        fc.setFunctionNameCode(nameCode);
        fc.setArguments(staticArgs);
        fc.setFunction(fn, env);
        fc.setStaticType(fn.getResultType());
        return fc;
    }
View Full Code Here

    public Expression bind(int nameCode, String uri, String local, Expression[] arguments) throws XPathException {
        int fp = getNamePool().allocate("", uri, local);
        Long keyObj = new Long(((long)arguments.length)<<32 + (long)fp);
        XQueryFunction fd = (XQueryFunction)functions.get(keyObj);
        if (fd != null) {
            UserFunctionCall ufc = new UserFunctionCall();
            ufc.setFunctionNameCode(nameCode);
            ufc.setArguments(arguments);
            ufc.setStaticType(fd.getResultType());
            UserFunction fn = fd.getUserFunction();
            if (fn == null) {
                // not yet compiled
                fd.registerReference(ufc);
            } else {
                ufc.setFunction(fn, fd.getStaticContext());
            }
            return ufc;
        } else if (allowForwardsReferences) {
            UserFunctionCall ufc = new UserFunctionCall();
            ufc.setFunctionNameCode(nameCode);
            ufc.setArguments(arguments);
            unboundFunctionCalls.add(ufc);
            return ufc;
        } else {
            return null;
        }
View Full Code Here

     */

    public void bindUnboundFunctionCalls() throws StaticError {
        Iterator iter = unboundFunctionCalls.iterator();
        while (iter.hasNext()) {
            UserFunctionCall ufc = (UserFunctionCall)iter.next();
            int fp = ufc.getFunctionNameCode() & 0xfffff;
            int arity = ufc.getNumberOfArguments();
            Long keyObj = new Long(((long)arity)<<32 + (long)fp);

            XQueryFunction fd = (XQueryFunction)functions.get(keyObj);
            if (fd != null) {
                ufc.setStaticType(fd.getResultType());
                fd.registerReference(ufc);
            } else {
                throw new StaticError("Function " +
                        getNamePool().getDisplayName(ufc.getFunctionNameCode()) +
                        " has not been declared",
                        ExpressionTool.getLocator(ufc));
            }
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.expr.UserFunctionCall$FunctionCallPackage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.