Package xbird.xquery.expr.var.BindingVariable

Examples of xbird.xquery.expr.var.BindingVariable.LetVariable


            return clause;
        }

        @Override
        public LetClause visit(LetClause clause, XQueryContext ctxt) throws XQueryException {
            LetVariable var = clause.getVariable();
            excludedVariableList.add(var);
            XQExpression e = var.getValue();
            e.visit(this, ctxt);
            return clause;
        }
View Full Code Here


        final Collection<ExpressionProxy> proxys = _invarients.values();
        if(!proxys.isEmpty()) {
            for(ExpressionProxy proxy : proxys) {
                final XQExpression orig = proxy.getOriginalExpr();
                final LetVariable lv = new LoopInvariantLetVariable(orig);
                proxy.setReplacedExpr(lv);
                final LetClause lc = new LetClause(lv);
                clauses.add(insertionPoint, lc);
            }
            _invarients.clear();
View Full Code Here

                            Variable pv = pathSrc.getValue();
                            if(pv instanceof BindingVariable) {
                                if(searchKeyExpr instanceof CompositePath
                                        && _currentForClause != null) {
                                    assert (_currentBindings != null);
                                    final LetVariable lv = new AnonymousLetVariable(searchKeyExpr);
                                    lv.incrementReferenceCount();
                                    final int bsize = _currentBindings.size();
                                    assert (bsize > 0) : bsize;
                                    boolean found = false;
                                    for(int i = 0; i < bsize; i++) {
                                        Binding binding = _currentBindings.get(i);
View Full Code Here

            throws XQueryException {
        Sequence input = new DummySequence(dynEnv);
        for(Binding bc : _clauses) {
            final int type = bc.getExpressionType();
            if(type == Binding.LET_CLAUSE) {
                LetVariable lv = ((LetClause) bc).getVariable();
                int refcnt = lv.getReferenceCount();
                if(refcnt == 0) {
                    continue;
                } else {
                    input = new ActionSequence(input, bc, dynEnv);
                }
View Full Code Here

        }
        Sequence<? extends Item> input = new DummySequence(dynEnv);
        for(Binding bc : _clauses) {
            final int bindingType = bc.getExpressionType();
            if(bindingType == Binding.LET_CLAUSE) {
                final LetVariable lv = ((LetClause) bc).getVariable();
                final int refcnt = lv.getReferenceCount();
                if(refcnt == 0) {
                    continue;
                }
                input = new ActionSequence(input, bc, dynEnv);
            } else if(bindingType == Binding.FOR_CLAUSE) {
View Full Code Here

        return "let $" + _variable.getName() + " := " + _variable.getValue().toString();
    }

    public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        LetVariable lv = (LetVariable) _variable;
        XQExpression letExpr = lv.getValue();
        Sequence<? extends Item> res = letExpr.eval(contextSeq, dynEnv);
        if(lv.attemptEagarEvaluation() && lv.getReferenceCount() > 1) {
            List<? extends Item> items = res.materialize(); // TODO REVIEWME weak memory utilization
            lv.allocateResult(new ValueSequence(items, dynEnv), dynEnv);
        } else {
            lv.allocateResult(res, dynEnv);
        }
        return res;
    }
View Full Code Here

            return clause;
        }

        @Override
        public LetClause visit(LetClause clause, XQueryContext ctxt) throws XQueryException {
            LetVariable lv = clause.getVariable();
            lv.setInsideRemoteExpr(true);
            XQExpression e = clause.getExpression();
            e.visit(this, ctxt);
            return clause;
        }
View Full Code Here

               ("," "$" VarName TypeDeclaration? ":=" ExprSingle)*
    [110] TypeDeclaration ::= "as" SequenceType
    ************************************************************************/
    final public List<Binding> parseLetClause() throws ParseException, XQueryException {
        final List<Binding> lets;
        LetVariable var;
        LetClause clause;
        Type varType = null;
        XQExpression expr = null;
        currentToken = jj_consume_token(LetVariable);
        currentToken = jj_consume_token(VarName);
        QualifiedName varName = QNameUtil.parse(currentToken.image, namespaceContext, currentModule.getNamespace());
        var = new LetVariable(varName);
        currentModule.putVariable(varName, var);
        clause = new LetClause(var);
        locate(clause);
        switch(jj_nt.kind) {
            case As:
                currentToken = jj_consume_token(As);
                varType = parseSequenceType();
                var.setType(varType);
                break;
            default:
                jj_la1[73] = jj_gen;
                ;
        }
        currentToken = jj_consume_token(ColonEquals);
        expr = parseExprSingle();
        var.setValue(expr);
        lets = new LinkedList<Binding>();
        lets.add(clause);
        label_11: while(true) {
            switch(jj_nt.kind) {
                case Comma:
                    ;
                    break;
                default:
                    jj_la1[74] = jj_gen;
                    break label_11;
            }
            //("," "$" VarName TypeDeclaration? ":=" ExprSingle)*
            currentToken = jj_consume_token(Comma);
            currentToken = jj_consume_token(VariableIndicator);
            currentToken = jj_consume_token(VarName);
            varName = QNameUtil.parse(currentToken.image, namespaceContext, currentModule.getNamespace());
            var = new LetVariable(varName);
            currentModule.putVariable(varName, var);
            clause = new LetClause(var);
            switch(jj_nt.kind) {
                case As:
                    currentToken = jj_consume_token(As);
                    varType = parseSequenceType();
                    var.setType(varType);
                    break;
                default:
                    jj_la1[75] = jj_gen;
                    ;
            }
            currentToken = jj_consume_token(ColonEquals);
            expr = parseExprSingle();
            var.setValue(expr);
            lets.add(clause);
        }
        {
            if(true)
                return lets;
View Full Code Here

        @Override
        public XQExpression visit(BindingVariable variable, XQueryContext ctxt)
                throws XQueryException {
            if(variable instanceof LetVariable) {
                LetVariable lv = (LetVariable) variable;
                lv.setEagarEvaluated(true);
            }
            return variable;
        }
View Full Code Here

            throws XQueryException {
        Sequence input = new DummySequence(dynEnv);
        for(Binding bc : _clauses) {
            final int type = bc.getExpressionType();
            if(type == Binding.LET_CLAUSE) {
                LetVariable lv = ((LetClause) bc).getVariable();
                int refcnt = lv.getReferenceCount();
                if(refcnt == 0) {
                    continue;
                } else {
                    input = new ActionSequence(input, bc, dynEnv);
                }
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.var.BindingVariable.LetVariable

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.