Package xbird.xquery.dm.value

Examples of xbird.xquery.dm.value.Sequence


                    srcItor.closeQuietly();
                    return BooleanValue.TRUE;
                } else {
                    final Item curitem = srcItor.next();
                    bindingVar.allocateResult(curitem, dynEnv);
                    final Sequence v = condExpr.eval(contextSeq, dynEnv);
                    if(!FnBoolean.effectiveBooleanValue(v)) {
                        srcItor.closeQuietly();
                        return BooleanValue.FALSE;
                    }
                }
            }
        } else {//some
            while(true) {
                if(!srcItor.hasNext()) {
                    srcItor.closeQuietly();
                    return BooleanValue.FALSE;
                } else {
                    final Item curitem = srcItor.next();
                    bindingVar.allocateResult(curitem, dynEnv);
                    final Sequence v = condExpr.eval(contextSeq, dynEnv);
                    if(FnBoolean.effectiveBooleanValue(v)) {
                        srcItor.closeQuietly();
                        return BooleanValue.TRUE;
                    }
                }
View Full Code Here


            return ValueSequence.EMPTY_SEQUENCE;
        }
        assert (firstItem instanceof XString);
        String viewloc = firstItem.stringValue();
        Reader reader = readQuery(viewloc, dynEnv.getStaticContext());
        Sequence res = Eval.evaluateQuery(reader, dynEnv);
        return res;
    }
View Full Code Here

        assert (paramArity == argArity);
        FunctionCallContext recEnv = new FunctionCallContext(dynEnv);
        for(int i = 0; i < paramArity; i++) {
            ParametricVariable paramVar = params.get(i);
            XQExpression argExpr = _params.get(i);
            Sequence argValue = argExpr.eval(contextSeq, dynEnv);
            paramVar.allocateResult(argValue, recEnv);
        }
        Sequence<? extends Item> result = uf.eval(contextSeq, ValueSequence.EMPTY_SEQUENCE, recEnv);
        if(LOG.isDebugEnabled()) {
            LOG.debug("Invoke RecursiveCall: " + QNameUtil.toLexicalForm(getFuncName()));
View Full Code Here

        FunctionCallContext recEnv = new FunctionCallContext(dynEnv);
        for(int i = 0; i < paramArity; i++) {
            ParametricVariable paramVar = params.get(i);
            XQExpression argExpr = _params.get(i);
            paramVar.setValue(argExpr); // for the static analzing
            Sequence argValue = argExpr.eval(contextSeq, dynEnv);
            paramVar.allocateResult(argValue, recEnv);
        }
        XQExpression body = udf.getBodyExpression();
        // lazy function may not be analyzed TODO REVIEWME
        XQExpression analyzed = body.staticAnalysis(dynEnv.getStaticContext());
View Full Code Here

            }
            return _result;
        }
        FunctionCallContext fctxt = (FunctionCallContext) dynEnv;
        int slotSize = fctxt.getSlotSize();
        final Sequence res;
        if(bindedSlot >= slotSize) {
            res = _value.eval(contextSeq, dynEnv);
            fctxt.storeLocal(this, res);
        } else if(bindedSlot == SLOT_UNSET) {
            res = _value.eval(contextSeq, dynEnv);
View Full Code Here

    }

    @Override
    public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        final Sequence res = loadResult(contextSeq, dynEnv);
        if(res == null) {
            throw new IllegalStateException("The value of '$" + getName() + "' is not binded");
        }
        return res;
    }
View Full Code Here

    }

    @Override
    public void evalAsEvents(XQEventReceiver handler, Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        final Sequence res = loadResult(contextSeq, dynEnv);
        if(res == null) {
            throw new IllegalStateException("The value of '$" + getName() + "' is not binded");
        }
        handler.emit(res);
    }
View Full Code Here

                            proc.setContextItem(contextItem);
                        }
                        final StringWriter res_sw = new StringWriter();
                        try {
                            XQueryModule mod = proc.parse(query, baseUri);
                            Sequence result = proc.execute(mod);
                            SAXWriter saxwriter = new SAXWriter(res_sw, SAXWriter.DEFAULT_ENCODING);
                            saxwriter.setXMLDeclaration(false);
                            Serializer ser = new SAXSerializer(saxwriter, res_sw);
                            ser.emit(result);
                        } catch (Throwable ex) {
View Full Code Here

        final List<String> endpoints = getEndpoints(_endpoint, contextSeq, dynEnv);
        final int numEndpoints = endpoints.size();
        if(numEndpoints == 0) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        final Sequence result;
        if(numEndpoints == 1) {
            result = invokeRequest(endpoints.get(0), request);
        } else if(_parallel) {
            result = invokeRequestsInParallel(endpoints, _hostVar, request, dynEnv);
        } else {
            Sequence lastSeq = invokeRequest(endpoints.get(0), request);
            for(int i = 1; i < numEndpoints; i++) {
                Sequence secSeq = invokeRequest(endpoints.get(i), request);
                lastSeq = new ChainedSequence(lastSeq, secSeq, dynEnv);
            }
            result = lastSeq;
        }
        return result;
View Full Code Here

            for(int i = 0; i < numEndpoints; i++) {
                final String endpoint = endpoints.get(i);
                final int at = i;
                Runnable r = new Runnable() {
                    public void run() {
                        final Sequence res;
                        try {
                            res = invokeRequest(endpoint, request);
                        } catch (XQueryException e) {
                            throw new IllegalStateException("An error caused while evaluating CompiledQueryRequest#"
                                    + request.getIdentifier() + " at " + endpoint, e);
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.Sequence

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.