Package org.exist.xquery.value

Examples of org.exist.xquery.value.GroupedValueSequence


                at.setValue(atVal);
            }

            int p = 0;
            for (final Iterator<String> it = groupedSequence.iterate(); it.hasNext(); ) {
                final GroupedValueSequence currentGroup = groupedSequence.get(it.next());
                context.proceed(this);
                // set binding variable to current group
                var.setValue(currentGroup);
                var.checkType();
                //set value of grouping keys for the current group
                for (int i=0; i< groupKeyVar.length ; i ++) {
                    groupKeyVar[i].setValue(currentGroup.getGroupKey().itemAt(i).toSequence());
                }
                if (positionalVariable != null) {
                    final ValueSequence ps = new ValueSequence();
                    for (int i = 0; i < currentGroup.getItemCount(); i++) {
                        ps.add(new IntegerValue(p + i + 1));
                    }
                    at.setValue(ps);
                }
                //evaluate real return expression
                final Sequence val = groupReturnExpr.eval(null);
                resultSequence.addAll(val);

                p += currentGroup.getItemCount();
            }
            //Reset the context position
            context.setContextSequencePosition(0, null);
            context.popLocalVariables(mark);
        }
View Full Code Here


            //Special processing for groupBy : one return per group in groupedSequence
            if (groupSpecs!=null) {
                mark = context.markLocalVariables(false);
                context.declareVariableBinding(var);
                for (final Iterator<String> it = groupedSequence.iterate(); it.hasNext();){
                    final GroupedValueSequence currentGroup = groupedSequence.get(it.next());
                    context.proceed(this);
                    // set binding variable to current group
                    var.setValue(currentGroup);
                    var.checkType();
                    // Set value of grouping keys for the current group
                    for (int i=0 ; i< groupKeyVar.length ; i ++) {
                        groupKeyVar[i].setValue(currentGroup.getGroupKey().itemAt(i).toSequence());
                    }
                    //Evaluate real return expression
                    final Sequence val = groupReturnExpr.eval(null);
                    resultSequence.addAll(val);
                }
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.GroupedValueSequence

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.