Package xbird.xquery.expr

Examples of xbird.xquery.expr.XQExpression


        }
        return expr;
    }

    public XQExpression visit(UserFunction function, XQueryContext ctxt) throws XQueryException {
        XQExpression body = function.getBodyExpression();
        body.visit(this, ctxt);
        boolean isLoopInvariant = body.isLoopInvariant();
        if(isLoopInvariant) {
            removeInvariants(body); // TODO REVIEWME
        }
        return null;
    }
View Full Code Here


        }
        return null;
    }

    public XQExpression visit(ValidateOp op, XQueryContext ctxt) throws XQueryException {
        XQExpression e = op.getExpression();
        e.visit(this, ctxt);
        boolean isLoopInvariant = e.isLoopInvariant();
        if(isLoopInvariant) {
            removeInvariants(e);
            return hookLoopInvariant(op);
        }
        return op;
View Full Code Here

    }

    public XQExpression visit(Variable variable, XQueryContext ctxt) throws XQueryException {
        boolean isLoopInvariant = false;
        if(variable.getResult() == null) {
            XQExpression e = variable.getValue();
            if(e == null) {
                return variable;
            }
            e.visit(this, ctxt);
            isLoopInvariant = e.isLoopInvariant();
            if(isLoopInvariant) {
                removeInvariants(e);
            }
        }
        if(isLoopInvariant) {
View Full Code Here

        return ref;
    }

    public XQExpression visit(BDQExpr expr, XQueryContext ctxt) throws XQueryException {
        // TODO REVIEWME
        XQExpression body = expr.getBodyExpression();
        expr.visit(this, ctxt);
        return expr;
    }
View Full Code Here

        expr.visit(this, ctxt);
        return expr;
    }

    public XQExpression visit(XQueryModule module, XQueryContext ctxt) throws XQueryException {
        XQExpression body = module.getExpression();
        body.visit(this, ctxt);
        return null;
    }
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);
            }
View Full Code Here

                throws XQueryException {
            if(path instanceof RelativePath) {
                final List<XQExpression> steps = path.getSteps();
                final int steplen = steps.size();
                for(int i = 0; i < steplen; i++) {
                    final XQExpression step = steps.get(i);
                    if(step instanceof VarRef) {
                        final VarRef ref = (VarRef) step;
                        final Variable referent = ref.getValue();
                        if(_targetVar == referent) {
                            if(_doReplace) {
                                steps.remove(i);
                            }
                            _detected = true;
                            return path;
                        }
                    }
                    step.visit(this, ctxt);
                }
            }
            super.visit(path, ctxt);
            return path;
        }
View Full Code Here

        }

        @Override
        public XQExpression visit(final PathVariable variable, final XQueryContext ctxt)
                throws XQueryException {
            final XQExpression pathExpr = variable.getValue();
            if(pathExpr instanceof CompositePath) {
                final CompositePath cp = (CompositePath) pathExpr;
                final XQExpression srcExpr = cp.getSourceExpr();
                assert (srcExpr != null);
                final XQExpression filterExpr = cp.getFilterExpr();
                assert (filterExpr != null);
                srcExpr.visit(this, ctxt);
                if(srcExpr == _target) {
                    variable.setValue(filterExpr);
                }
                filterExpr.visit(this, ctxt);
            }
            return variable;
        }
View Full Code Here

        public XQExpression visit(final PathExpr path, final XQueryContext ctxt)
                throws XQueryException {
            final List<XQExpression> steps = path.getSteps();
            int steplen = steps.size();
            for(int i = 0; i < steplen; i++) {
                final XQExpression s = steps.get(i);
                if(s instanceof VarRef) {
                    final Variable var = ((VarRef) s).getValue();
                    if(var == _target) {
                        if(steplen > 1) {
                            final XQExpression next = steps.get(i + 1);
                            if(next instanceof StepExpr) {
                                steps.remove(i);
                                --steplen;
                                continue;
                            }
View Full Code Here

        }

        @Override
        public XQExpression visit(final VarRef ref, final XQueryContext ctxt)
                throws XQueryException {
            XQExpression referent = ref.getValue();
            if(referent instanceof ParametricVariable) {
                XQExpression argv = ((ParametricVariable) referent).getValue();
                if(argv instanceof TypePromotedExpr) {
                    argv = ((TypePromotedExpr) argv).getPromotedExpr();
                    if(argv instanceof VarRef) {
                        referent = ((VarRef) argv).getValue();
                    }
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.XQExpression

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.