Examples of SequenceIterator


Examples of client.net.sf.saxon.ce.om.SequenceIterator

            return CodepointCollator.getInstance();
        }
    }

    private GroupIterator getGroupIterator(XPathContext context) throws XPathException {
        SequenceIterator population = select.iterate(context);

        // get an iterator over the groups in "order of first appearance"

        GroupIterator groupIterator;
        switch (algorithm) {
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

    /**
    * Iterate over the sequence of values
    */

    public SequenceIterator iterate(final XPathContext context) throws XPathException {
        SequenceIterator base = operand.iterate(context);
        ItemMappingFunction converter = new ItemMappingFunction() {
            public Item mapItem(Item item) throws XPathException {
                return ((AtomicValue)item).convert(requiredPrimitiveType, true).asAtomic();
            }
        };
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

    /**
    * Evaluate the expression as a boolean
    */

    public boolean effectiveBooleanValue(XPathContext context) throws XPathException {
        SequenceIterator iter = operand.iterate(context);
        return isInstance(iter, context);
    }
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

    public int position() {
        return position;
    }

    public SequenceIterator getAnother() throws XPathException {
        SequenceIterator newBase = base.getAnother();
        XPathContextMinor c2 = context.newMinorContext();
        c2.setCurrentIterator(newBase);
        return new ContextMappingIterator(action, c2);
    }
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

                savedXPathContext.setStackFrame(stackFrameMap, savedStackFrame);
            }
        }

        // Make a copy of the context item
        SequenceIterator currentIterator = context.getCurrentIterator();
        if (currentIterator != null) {
            Item contextItem = currentIterator.current();
            UnfailingIterator single = SingletonIterator.makeIterator(contextItem);
            single.next();
            savedXPathContext.setCurrentIterator(single);
            // we don't save position() and last() because we have no way
            // of restoring them. So the caller must ensure that a Closure is not
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

    * @param e The NodeInfo representing the Element or other node to be tested against the Pattern
    * @return true if the node matches the Pattern, false otherwise
    */

    public boolean matches(NodeInfo e, XPathContext context) throws XPathException {
        SequenceIterator iter = expression.iterate(context);
        while (true) {
            NodeInfo node = (NodeInfo)iter.next();
            if (node == null) {
                return false;
            }
            if (node.isSameNodeInfo(e)) {
                return true;
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

        // iteration of the filter expression than are absolutely essential.

        // The code is almost identical to the code in ExpressionTool#effectiveBooleanValue
        // except for the handling of a numeric result

        SequenceIterator iterator = filter.iterate(filterContext);
        Item first = iterator.next();
        if (first == null) {
            return false;
        }
        if (first instanceof NodeInfo) {
            return true;
        } else {
            if (first instanceof BooleanValue) {
                if (iterator.next() != null) {
                    ExpressionTool.ebvError("sequence of two or more items starting with a boolean");
                }
                return ((BooleanValue)first).getBooleanValue();
            } else if (first instanceof StringValue) {
                if (iterator.next() != null) {
                    ExpressionTool.ebvError("sequence of two or more items starting with a string");
                }
                return (first.getStringValueCS().length()!=0);
            } else if (first instanceof IntegerValue) {
                if (iterator.next() != null) {
                    ExpressionTool.ebvError("sequence of two or more items starting with a numeric value");
                }
                return ((IntegerValue)first).intValue() == base.position();

            } else if (first instanceof NumericValue) {
                if (iterator.next() != null) {
                    ExpressionTool.ebvError("sequence of two or more items starting with a numeric value");
                }
                return ((NumericValue)first).compareTo(base.position()) == 0;
            } else {
                ExpressionTool.ebvError("sequence starting with an atomic value other than a boolean, number, or string");
View Full Code Here

Examples of client.net.sf.saxon.ce.om.SequenceIterator

     * @throws XPathException
     */

    protected void processItem(HashMap<ComparisonKey, List<Item>> index,
                               Item item, XPathContext c2) throws XPathException {
        SequenceIterator keys = keyExpression.iterate(c2);
        boolean firstKey = true;
        while (true) {
            AtomicValue key = (AtomicValue) keys.next();
            if (key==null) {
                break;
            }
            ComparisonKey comparisonKey = comparer.getComparisonKey(key);
            List<Item> g = index.get(comparisonKey);
View Full Code Here

Examples of net.sf.saxon.om.SequenceIterator

        tuple.add(rowCount);
      } else {
        try {
          XPathExpression path = proColumn.getPathExpression();
          XPathDynamicContext dynamicContext = path.createDynamicContext(item);
          SequenceIterator pathIter = path.iterate(dynamicContext);
          Item colItem = pathIter.next();
          if (colItem == null) {
            if (proColumn.getDefaultExpression() != null) {
              tuple.add(getEvaluator(Collections.emptyMap()).evaluate(proColumn.getDefaultExpression(), null));
            } else {
              tuple.add(null);
            }
            continue;
          }
          if (proColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
            XMLType value = table.getXQueryExpression().createXMLType(pathIter.getAnother(), this.getBufferManager(), false);
            tuple.add(value);
            continue;
          }
          if (pathIter.next() != null) {
            throw new TeiidProcessingException(QueryPlugin.Util.getString("XMLTableName.multi_value", proColumn.getName())); //$NON-NLS-1$
          }
          Object value = Value.convertToJava(colItem);
          if (value instanceof Item) {
            Item i = (Item)value;
View Full Code Here

Examples of net.sf.saxon.om.SequenceIterator

    public String evaluateAsString(Exchange exchange) throws Exception {
        initialize(exchange);

        StringWriter buffer = new StringWriter();
        SequenceIterator iter = getExpression().iterator(createDynamicContext(exchange));
        for (Item item = iter.next(); item != null; item = iter.next()) {
            buffer.append(item.getStringValueCS());
        }
        return buffer.toString();
    }
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.