Package net.sf.saxon.value

Examples of net.sf.saxon.value.SequenceExtent


     public Expression simplify(ExpressionVisitor visitor) throws XPathException {
        operand = visitor.simplify(operand);
        if (operand instanceof Literal) {
            return Literal.makeLiteral(
                    new SequenceExtent(iterate(visitor.getStaticContext().makeEarlyEvaluationContext())));
        }
        return this;
    }
View Full Code Here


            if (allAtomic) {
                AtomicValue[] values = new AtomicValue[children.length];
                for (int c=0; c<children.length; c++) {
                    values[c] = (AtomicValue)((Literal)children[c]).getValue();
                }
                return Literal.makeLiteral(new SequenceExtent(values));
            }
        } else {
            return Literal.makeEmptySequence();
        }
View Full Code Here

            if (allAtomic) {
                Item[] items = new Item[children.length];
                for (int c=0; c<children.length; c++) {
                    items[c] = (AtomicValue)((Literal)children[c]).getValue();
                }
                return new Literal(new SequenceExtent(items));
            }
        }
        return this;
    }
View Full Code Here

        } else if (object instanceof Node[]) {
            NodeInfo[] nodes = new NodeInfo[((Node[])object).length];
            for (int i=0; i<nodes.length; i++) {
                nodes[i] = wrapNode(((Node[])object)[i], config);
            }
            return new SequenceExtent(nodes);
        } else {
            return null;
        }
    }
View Full Code Here

                    Expression cexp = new UntypedAtomicConverter(exp, (AtomicType)reqItemType, true);
                    ExpressionTool.copyLocationInfo(exp, cexp);
                    try {
                        if (exp instanceof Literal) {
                            exp = Literal.makeLiteral(
                                    new SequenceExtent(cexp.iterate(env.makeEarlyEvaluationContext())).simplify());
                        } else {
                            exp = cexp;
                        }
                    } catch (XPathException err) {
                        err.maybeSetLocation(exp);
                        throw err.makeStatic();
                    }
                    itemTypeOK = true;
                    suppliedItemType = reqItemType;
                }

                //   2b: some supplied values are untyped atomic. Convert these to the required type; but
                //   there may be other values in the sequence that won't convert and still need to be checked

                if ((suppliedItemType.equals(BuiltInAtomicType.ANY_ATOMIC))
                    && !(reqItemType.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || reqItemType.equals(BuiltInAtomicType.ANY_ATOMIC))) {

                    Expression cexp = new UntypedAtomicConverter(exp, (AtomicType)reqItemType, false);
                    ExpressionTool.copyLocationInfo(exp, cexp);
                    try {
                        if (exp instanceof Literal) {
                            exp = Literal.makeLiteral(
                                    new SequenceExtent(cexp.iterate(env.makeEarlyEvaluationContext())).simplify());
                        } else {
                            exp = cexp;
                        }
                        suppliedItemType = exp.getItemType(th);
                    } catch (XPathException err) {
View Full Code Here

     *
     * @return the corresponding SequenceValue
     */

    public GroundedValue materialize() {
        return new SequenceExtent(list);
    }
View Full Code Here

    public DocumentOrderIterator(SequenceIterator base, NodeOrderComparer comparer) throws XPathException {

        this.comparer = comparer;

        sequence = new SequenceExtent(base);
        //System.err.println("sort into document order: sequence length = " + sequence.getLength());
        if (sequence.getLength()>1) {
            //QuickSort.sort(this, 0, sequence.getLength()-1);
            GenericSorter.quickSort(0, sequence.getLength(), this);
            //GenericSorter.mergeSort(0, sequence.getLength(), this);
View Full Code Here

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        SequenceIterator forwards = argument[0].iterate(context);
        if (forwards instanceof ReversibleIterator) {
            return ((ReversibleIterator)forwards).getReverseIterator();
        } else {
            SequenceExtent extent = new SequenceExtent(forwards);
            return extent.reverseIterate();
        }
    }
View Full Code Here

     * @return the typed value.
     * @since 8.5
     */

    public Value atomize(NodeInfo node) throws XPathException {
        return new SequenceExtent(getTypedValue(node)).simplify();
    }
View Full Code Here

        } else {
            origin = evaluator.getConfiguration().buildDocument(source);
        }
        XPathDynamicContext dynamicContext = createDynamicContext(origin);
        SequenceIterator iter = iterate(dynamicContext);
        SequenceExtent extent = new SequenceExtent(iter);
        List result = (List)extent.convertToJava(List.class, dynamicContext.getXPathContextObject());
        if (result == null) {
            result = Collections.EMPTY_LIST;
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.SequenceExtent

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.