Package xbird.xquery.expr.var

Examples of xbird.xquery.expr.var.VarRef


    public boolean equals(OrderSpec other) {
        XQExpression orderExpr = other.getKeyExpr();
        if(!(orderExpr instanceof VarRef)) {
            return false;
        }
        VarRef orderingVarRef = (VarRef) orderExpr;
        Variable orderingVar = orderingVarRef.getValue();
        if(orderingVar != groupingVariable) {
            return false;
        }
        if(other.getCollation() != getCollation()) {
            return false;
View Full Code Here


    public void testLookupFunction() throws XQueryException, IllegalAccessException,
            NoSuchFieldException, NoSuchMethodException, InvocationTargetException {
        // params
        Variable v1 = new Variable.GlobalVariable(QNameTable.instantiate("", "p1"), new LiteralExpr(new XDouble(4)));
        v1.setType(DoubleType.DOUBLE);
        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);
View Full Code Here

        List params = function.getParameters();
        for(int i = 0; i < params.size(); i++) {
            if(i != 0) {
                buf.append(", ");
            }
            VarRef p = (VarRef) params.get(i);
            buf.append(p.toString());
        }
        buf.append(") ");
        Type returnType = function.getReturnType();
        if(returnType != null) {
            buf.append("as ");
View Full Code Here

                            leftSrc = ((CompositePath) leftSrc).getSourceExpr();
                        }
                        while(rightSrc instanceof CompositePath) {
                            rightSrc = ((CompositePath) rightSrc).getSourceExpr();
                        }
                        VarRef pathSrc = null;
                        XQExpression persistKeyExpr = null, searchKeyExpr = null;
                        if(leftSrc instanceof VarRef && !(rightSrc instanceof VarRef)) {
                            pathSrc = (VarRef) leftSrc;
                            persistKeyExpr = right;
                            searchKeyExpr = left;
                        } else if(rightSrc instanceof VarRef && !(leftSrc instanceof VarRef)) {
                            pathSrc = (VarRef) rightSrc;
                            persistKeyExpr = left;
                            searchKeyExpr = right;
                        }
                        if(pathSrc != null) {
                            if(isFirst) {
                                persistKeyExprs = new ArrayList<XQExpression>(4);
                                searchKeyExprs = new ArrayList<XQExpression>(4);
                            }
                            Variable pv = pathSrc.getValue();
                            if(pv instanceof BindingVariable) {
                                if(searchKeyExpr instanceof CompositePath
                                        && _currentForClause != null) {
                                    assert (_currentBindings != null);
                                    final LetVariable lv = new AnonymousLetVariable(searchKeyExpr);
View Full Code Here

                QualifiedName vn = QNameUtil.parse(currentToken.image, namespaceContext, defaultNamespace);
                Variable var = currentModule.getVariable(vn);
                if(var == null) {
                    error("err:XPST0008");
                }
                expr = new VarRef(var);
                break;
            case Lpar:
                //ParenthesizedExpr
                currentToken = jj_consume_token(Lpar);
                switch(jj_nt.kind) {
View Full Code Here

                            FLWRExpr newFlwr = new FLWRExpr();
                            ForVariable forVar = new ForVariable();
                            forVar.setValue(funcall);
                            newFlwr.addClause(new ForClause(forVar));
                            VarRef varref = new VarRef(forVar);
                            steps.set(0, varref);
                            newFlwr.setFilteredReturnExpr(pathExpr);

                            MapExpr mapExpr = new MapExpr(colpath, forVar, newFlwr);
                            return mapExpr.staticAnalysis(statEnv);
View Full Code Here

            if(srcVar instanceof ForVariable) {
                return null; //TODO REVIEWME
            }
            final XQExpression srcExpr = srcVar.getValue();
            if(srcExpr instanceof VarRef) {
                VarRef ref = (VarRef) srcExpr;
                Variable var = ref.getValue();
                assert (var != null);
                return rewrite(var, filterExpr, statEnv);
            } else if(srcExpr instanceof Variable) {
                Variable var = (Variable) srcExpr;
                return rewrite(var, filterExpr, statEnv);
View Full Code Here

                            leftSrc = ((CompositePath) leftSrc).getSourceExpr();
                        }
                        while(rightSrc instanceof CompositePath) {
                            rightSrc = ((CompositePath) rightSrc).getSourceExpr();
                        }
                        VarRef pathSrc = null;
                        XQExpression persistKeyExpr = null, searchKeyExpr = null;
                        if(leftSrc instanceof VarRef && !(rightSrc instanceof VarRef)) {
                            pathSrc = (VarRef) leftSrc;
                            persistKeyExpr = right;
                            searchKeyExpr = left;
                        } else if(rightSrc instanceof VarRef && !(leftSrc instanceof VarRef)) {
                            pathSrc = (VarRef) rightSrc;
                            persistKeyExpr = left;
                            searchKeyExpr = right;
                        }
                        if(pathSrc != null) {
                            if(isFirst) {
                                persistKeyExprs = new ArrayList<XQExpression>(4);
                                searchKeyExprs = new ArrayList<XQExpression>(4);
                            }
                            Variable pv = pathSrc.getValue();
                            if(pv instanceof BindingVariable) {
                                if(searchKeyExpr instanceof CompositePath
                                        && _currentForClause != null) {
                                    assert (_currentBindings != null);
                                    final LetVariable lv = new AnonymousLetVariable(searchKeyExpr);
View Full Code Here

                QualifiedName vn = QNameUtil.parse(currentToken.image, namespaceContext, defaultNamespace);
                Variable var = currentModule.getVariable(vn);
                if(var == null) {
                    error("err:XPST0008");
                }
                expr = new VarRef(var);
                break;
            case Lpar:
                //ParenthesizedExpr
                currentToken = jj_consume_token(Lpar);
                switch(jj_nt.kind) {
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.var.VarRef

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.