Package xbird.xquery.expr.flwr

Examples of xbird.xquery.expr.flwr.OrderSpec


                buf.append("order by");
            } else {
                buf.append(',');
            }
            indentln();
            OrderSpec spec = (OrderSpec) orders.get(i);
            spec.getKeyExpr().visit(this, ctxt);
            indent--;
            if(spec.isDescending()) {
                buf.append(" descending");
            }
            if(spec.isEmptyGreatest()) {
                buf.append(" empty greatest");
            }
            URI collation = spec.getCollation();
            if(collation != null) {
                buf.append(" collation ");
                buf.append(collation.toString());
            }
        }
View Full Code Here


                final IFocus<? extends Item> itor = src.iterator();
                for(Item it : itor) {
                    final Comparable[] tuple = new Comparable[keylen + 1];
                    tuple[0] = it;
                    for(int i = 0; i < keylen; i++) {
                        final OrderSpec key = oderSpecs.get(i);
                        final Sequence<? extends Item> keyval = key.getKeyExpr().eval(contextSeq, dynEnv);
                        if(keyval.isEmpty()) {
                            tuple[i + 1] = null;
                        } else {
                            final Sequence<? extends Item> atomized = keyval.atomize(dynEnv);
                            final Item keyitem = SingleCollection.wrap(atomized, dynEnv);
View Full Code Here

                final int cmp;
                final int keyidx = i + 1;
                if(o1[keyidx] instanceof Item) {
                    final Item it1 = (Item) o1[keyidx];
                    final Item it2 = (Item) o2[keyidx];
                    final OrderSpec spec = orderSpecs.get(i);
                    cmp = spec.compare(it1, it2, dynEnv);
                } else {
                    final OrderSpec spec = orderSpecs.get(i);
                    cmp = spec.compare(o1[keyidx], o2[keyidx]);
                }
                if(cmp != 0) {
                    return cmp;
                }
            }
View Full Code Here

    ************************************************************************/
    final public XQExpression parseFLWRExpr() throws ParseException, XQueryException {
        final FLWRExpr flower = new FLWRExpr();
        List<Binding> bindings = null;
        XQExpression whereExpr = null;
        OrderSpec order = null;
        XQExpression returnExpr = null;
        currentModule.pushVarScope();
        locate(flower);
        label_7: while(true) {
            switch(jj_nt.kind) {
View Full Code Here

    /************************************************************************
    [40] OrderSpec      ::=  ExprSingle OrderModifier
    [41] OrderModifier ::= ("ascending" | "descending")? (<"empty" "greatest"> | <"empty" "least">)? ("collation" URILiteral)?
    ************************************************************************/
    final public OrderSpec parseOrderSpec() throws ParseException, XQueryException {
        final OrderSpec spec;
        final XQExpression keyExpr;
        String collation = null;
        keyExpr = parseExprSingle();
        spec = new OrderSpec(keyExpr);
        locate(spec);
        switch(jj_nt.kind) {
            case Ascending:
            case Descending:
                switch(jj_nt.kind) {
                    case Ascending:
                        currentToken = jj_consume_token(Ascending);
                        break;
                    case Descending:
                        currentToken = jj_consume_token(Descending);
                        spec.setDescending(true);
                        break;
                    default:
                        jj_la1[78] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                break;
            default:
                jj_la1[79] = jj_gen;
                ;
        }
        switch(jj_nt.kind) {
            case EmptyGreatest:
            case EmptyLeast:
                switch(jj_nt.kind) {
                    case EmptyGreatest:
                        currentToken = jj_consume_token(EmptyGreatest);
                        spec.setEmptyGreatest(true);
                        break;
                    case EmptyLeast:
                        currentToken = jj_consume_token(EmptyLeast);
                        break;
                    default:
                        jj_la1[80] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                break;
            default:
                jj_la1[81] = jj_gen;
                ;
        }
        switch(jj_nt.kind) {
            case Collation:
                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
                break;
View Full Code Here

                final IFocus<? extends Item> itor = src.iterator();
                for(Item it : itor) {
                    final Comparable[] tuple = new Comparable[keylen + 1];
                    tuple[0] = it;
                    for(int i = 0; i < keylen; i++) {
                        final OrderSpec key = oderSpecs.get(i);
                        final Sequence<? extends Item> keyval = key.getKeyExpr().eval(contextSeq, dynEnv);
                        if(keyval.isEmpty()) {
                            tuple[i + 1] = null;
                        } else {
                            final Sequence<? extends Item> atomized = keyval.atomize(dynEnv);
                            final Item keyitem = SingleCollection.wrap(atomized, dynEnv);
View Full Code Here

                final int cmp;
                final int keyidx = i + 1;
                if(o1[keyidx] instanceof Item) {
                    final Item it1 = (Item) o1[keyidx];
                    final Item it2 = (Item) o2[keyidx];
                    final OrderSpec spec = orderSpecs.get(i);
                    cmp = spec.compare(it1, it2, dynEnv);
                } else {
                    final OrderSpec spec = orderSpecs.get(i);
                    cmp = spec.compare(o1[keyidx], o2[keyidx]);
                }
                if(cmp != 0) {
                    return cmp;
                }
            }
View Full Code Here

     ************************************************************************/
    final public XQExpression parseFLWRExpr() throws ParseException, XQueryException {
        final FLWRExpr flower = new FLWRExpr();
        List<Binding> bindings = null;
        XQExpression whereExpr = null;
        OrderSpec order = null;
        XQExpression returnExpr = null;
        currentModule.pushVarScope();
        locate(flower);
        label_7: while(true) {
            switch(jj_nt.kind) {
View Full Code Here

    /************************************************************************
     [40] OrderSpec      ::=  ExprSingle OrderModifier
     [41] OrderModifier ::= ("ascending" | "descending")? (<"empty" "greatest"> | <"empty" "least">)? ("collation" URILiteral)?
     ************************************************************************/
    final public OrderSpec parseOrderSpec() throws ParseException, XQueryException {
        final OrderSpec spec;
        final XQExpression keyExpr;
        String collation = null;
        keyExpr = parseExprSingle();
        spec = new OrderSpec(keyExpr);
        locate(spec);
        switch(jj_nt.kind) {
            case Ascending:
            case Descending:
                switch(jj_nt.kind) {
                    case Ascending:
                        currentToken = jj_consume_token(Ascending);
                        break;
                    case Descending:
                        currentToken = jj_consume_token(Descending);
                        spec.setDescending(true);
                        break;
                    default:
                        jj_la1[73] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                break;
            default:
                jj_la1[74] = jj_gen;
                ;
        }
        switch(jj_nt.kind) {
            case EmptyGreatest:
            case EmptyLeast:
                switch(jj_nt.kind) {
                    case EmptyGreatest:
                        currentToken = jj_consume_token(EmptyGreatest);
                        spec.setEmptyGreatest(true);
                        break;
                    case EmptyLeast:
                        currentToken = jj_consume_token(EmptyLeast);
                        break;
                    default:
                        jj_la1[75] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                break;
            default:
                jj_la1[76] = jj_gen;
                ;
        }
        switch(jj_nt.kind) {
            case Collation:
                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
                break;
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.flwr.OrderSpec

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.