Package xbird.xquery.expr

Examples of xbird.xquery.expr.XQExpression.eval()


            return "";
        }
        final StringBuilder buf = new StringBuilder(128);
        for(int i = 0; i < size; i++) {
            final XQExpression v = valueExprs.get(i);
            final Sequence rawseq = v.eval(contextSeq, dynEnv);
            final Sequence seq = AtomizedSequence.wrap(rawseq, dynEnv);
            final IFocus<Item> itor = seq.iterator();
            if(itor.hasNext()) {
                while(true) {
                    final Item it = itor.next();
View Full Code Here


        if(_local) {
            final XQExpression valueExpr = _value;
            if(valueExpr == null) {
                throw new IllegalStateException();
            }
            result = valueExpr.eval(contextSeq, dynEnv);
            this._result = result;
        }
        return result;
    }
View Full Code Here

            } else if(paramSize == 1) {
                XQExpression expr = _params.get(0);
                if(expr instanceof Evaluable) {
                    final Sequence<? extends Item> result;
                    try {
                        result = expr.eval(null, DynamicContext.DUMMY);
                    } catch (XQueryException e) {
                        throw new IllegalStateException(e);
                    }
                    colpath = result.toString();
                } else {
View Full Code Here

        } else {
            argv = new ValueSequence(dynEnv);
            FunctionSignature sign = func.getFunctionSignature(arity);
            for(int i = 0; i < arity; i++) {
                XQExpression p = _params.get(i);
                Sequence seq = p.eval(contextSeq, dynEnv);
                Sequence converted = mapFunctionArgument(seq, sign.getArgumentType(i), dynEnv);
                argv.addItem(SingleCollection.wrap(converted, dynEnv));
            }
        }
        return func.eval(contextSeq, argv, dynEnv);
View Full Code Here

    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);
View Full Code Here

            }
        }
        // execute
        final Sequence<? extends Item> result;
        try {
            result = body.eval(null, new DynamicContext(loaded.staticEnv));
        } catch (XQueryException e) {
            reportError("Execution failed: " + queryPath, e, out);
            return;
        }
        // serialize       
View Full Code Here

            int counter = 0;
            outer: for(Item it : srcItor) {
                final Comparable[] persistKeys = new Comparable[keysize];
                if(keysize == 1) {
                    final XQExpression key = _pkeyExprs.get(0);
                    final IFocus<? extends Item> pkvItor = key.eval(it, dynEnv).iterator();
                    for(Item fpv : pkvItor) {
                        if(_isNodeComp || fpv instanceof AtomicValue) {
                            persistKeys[0] = fpv;
                        } else {
                            if(counter == 0) {
View Full Code Here

                    }
                    pkvItor.closeQuietly();
                } else {// TODO FIXME multiple join keys   
                    for(int i = 0; i < keysize; i++) {
                        final XQExpression key = _pkeyExprs.get(i);
                        final Sequence<? extends Item> pkv = key.eval(it, dynEnv);
                        final Iterator<? extends Item> pkvItor = pkv.iterator();
                        if(!pkvItor.hasNext()) {
                            continue outer;
                        }
                        final Item fpv = pkvItor.next();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.