Package xbird.xquery.func

Examples of xbird.xquery.func.Function


        VarRef p1 = new VarRef(v1);
        List<VarRef> params = new LinkedList<VarRef>();
        params.add(p1);
        // function
        QualifiedName fname = QNameTable.instantiate("java:java.lang.Math", "sqrt");
        Function f = new FunctionManager().lookupFunction(fname, params);
        assertNotNull(f);
        f.staticAnalysis(null, params);

        // invoke binded java method.
        Method bindedMethod = (Method) PrivilegedAccessor.getValue(f, "bindedMethod");
        System.out.println("java.lang.Math.sqrt(4.0) = "
                + bindedMethod.invoke(bindedMethod, new Double(4)));
View Full Code Here


    }

    public static XQExpression createFunctionCall(Module module, QualifiedName funcName, List<XQExpression> argv, StaticContext statEnv)
            throws XQueryException {
        final FunctionManager funcMgr = module.getFunctionManager();
        final Function func = module.lookupFunction(funcName, argv);
        if(func == null) {
            return new LazyFunctionCall(funcMgr, funcName, argv);
        }
        // [note] ~ attempt function inlining ~
        //  function call in function decl is not inlined
View Full Code Here

                                innerModified = true;
                                break inner;
                            }
                        }
                    } else if(left instanceof DirectFunctionCall) {
                        final Function func = ((DirectFunctionCall) left).getFunction();
                        if(func instanceof Position) {
                            if(firstBindingExpr instanceof PathExpr) {
                                final PathExpr bindingPathExpr = (PathExpr) firstBindingExpr;
                                if(TypeUtil.subtypeOf(right.getType(), NumericType.getInstance())) {
                                    bindingPathExpr.addPredicate(right);
View Full Code Here

        }

        @Override
        public XQExpression visit(final DirectFunctionCall call, final XQueryContext ctxt)
                throws XQueryException {
            final Function func = (call).getFunction();
            if(func instanceof Position) {
                for(final Binding target : _clauses) {
                    final int type = target.getExpressionType();
                    if(type == Binding.FOR_CLAUSE) {
                        _dependent = target;
View Full Code Here

    private UserFunction getUserFunction(final StaticContext statEnv) throws XQueryException {
        if(_functionManager == null) {
            this._functionManager = statEnv.getFunctionManager();
        }
        final Function func = _functionManager.lookupFunction(_funcName, _params);
        if(func == null) {
            throw new XQueryException("err:XPST0017", "function not found: " + _funcName);
        }
        if(!(func instanceof UserFunction)) {
            throw new IllegalStateException("function must be UserFunction, but was '"
                    + func.getName() + '\'');
        }
        UserFunction udf = ((UserFunction) func);
        return udf;
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.func.Function

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.