Package xbird.xquery.expr.var

Examples of xbird.xquery.expr.var.BindingVariable


        public PreGroupingVariableExtractor(GroupingSpec[] specs) {
            this.variablesHolder = new ArrayList<BindingVariable>(4);
            this.excludedVariableList = new IdentityHashSet<Variable>(8);
            for(GroupingSpec spec : specs) {
                BindingVariable var = spec.getKeyExpr();
                excludedVariableList.add(var);
            }
        }
View Full Code Here


        final Map<String, List<GridNode>> mapping = collector.getMapping();
        if(mapping.isEmpty()) {// no mapping found
            return Collections.emptyMap();
        }

        final BindingVariable bindingVar = mapExpr.getBindingVariable();
        final XQExpression bodyExpr = mapExpr.getBodyExpression();
        final byte[] exprBytes = DispatchQueryExecTask.toBytes(bindingVar, bodyExpr);

        final GridNodeSelector selector = config.getNodeSelector();
        assert (selector != null);
View Full Code Here

        }
        if(mapping.isEmpty()) {// no mapping found
            return Collections.emptyMap();
        }

        final BindingVariable bindingVar = mapExpr.getBindingVariable();
        final XQExpression bodyExpr = mapExpr.getBodyExpression();
        final GridNodeSelector selector = config.getNodeSelector();
        assert (selector != null);

        final Map<GridNode, List<String>> nodeKeysMap = new HashMap<GridNode, List<String>>(numLiveNodes);
View Full Code Here

        }

        public void assignNonGroupingVariables() {
            if(nonGroupingVaribales != null && !nonGroupingVaribales.isEmpty()) {
                for(Entry<BindingVariable, Sequence> entry : nonGroupingVaribales.entrySet()) {
                    BindingVariable var = entry.getKey();
                    Sequence value = entry.getValue();
                    var.allocateResult(value, dynEnv);
                }
            }
        }
View Full Code Here

        }

        public void assignGroupingKeys() {
            final int len = _specs.length;
            for(int i = 0; i < len; i++) {
                BindingVariable groupingVar = _specs[i].getKeyExpr();
                groupingVar.allocateResult(_rawKeys[i], _dynEnv);
            }
        }
View Full Code Here

        if(expr.isEvery()) {
            buf.append("every ");
        } else {
            buf.append("some ");
        }
        BindingVariable binding = expr.getBinding();
        assert (binding != null);
        buf.append('$');
        buf.append(binding.getName());

        buf.append(" in ");
        indentln();
        XQExpression inExpr = binding.getValue();
        inExpr.visit(this, ctxt);
        indent--;

        lineFeed();
        buf.append("satisfies");
View Full Code Here

                    final int refcnt = ((BindingVariable) referent).getReferenceCount();
                    if(refcnt == 1) {
                        final int csize = flwr.getClauses().size();
                        if(csize > 0) {
                            final Binding clause = flwr.getClauses().get(0);
                            final BindingVariable bindingVar = clause.getVariable();
                            if(bindingVar == referent) {
                                final XQExpression bindingExpr = bindingVar.getValue();
                                pathExpr.setStep(0, bindingExpr);
                                return pathExpr;
                            }
                        }
                    }
                }
            }
        } else if(retExpr instanceof VarRef) {
            final Variable referent = ((VarRef) retExpr).getValue();
            if(referent instanceof BindingVariable) {
                final int refcnt = ((BindingVariable) referent).getReferenceCount();
                if(refcnt == 1) {
                    for(Binding clause : flwr.getClauses()) {
                        final BindingVariable bindingVar = clause.getVariable();
                        if(bindingVar == referent) {
                            XQExpression bindingExpr = bindingVar.getValue();
                            Type type = bindingVar.getType();
                            if(type != Untyped.UNTYPED) {
                                return new TypePromotedExpr(bindingExpr, type);
                            } else {
                                return bindingExpr;
                            }
View Full Code Here

        final List<Binding> clauses = flwr.getClauses();
        int csize = clauses.size();
        for(int i = 0; i < csize; i++) {
            final Binding binding = clauses.get(i);
            if(binding.getExpressionType() == Binding.LET_CLAUSE) {
                BindingVariable bv = binding.getVariable();
                final int refcnt = bv.getReferenceCount();
                if((refcnt == 0) || (refcnt == 1)) {
                    clauses.remove(i--);
                    --csize;
                }
            }
View Full Code Here

        return flwr;
    }

    private static final XQExpression applyFLWRFlattingInternal(final VarRef ret, final Binding firstBinding, final FLWRExpr flwr) {
        final Variable referent = ret.getValue();
        final BindingVariable bindingVar = firstBinding.getVariable();
        if(referent == bindingVar) {
            return bindingVar.getValue();
        }
        final XQExpression bindingExpr = firstBinding.getExpression();
        if(referent == bindingExpr) {
            return bindingExpr;
        }
View Full Code Here

                final Variable referent = ((VarRef) bindingExpr).getValue();
                if(referent instanceof LetVariable) {
                    final int refcnt = ((LetVariable) referent).getReferenceCount();
                    if(refcnt == 1) {
                        final XQExpression refExpr = referent.getValue();
                        final BindingVariable bv = clause.getVariable();
                        bv.setValue(refExpr);
                    }
                }
            }
        }
    }
View Full Code Here

TOP

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

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.