/** * Get an item mapping iterator suitable for multi-threaded execution, if this is permitted * * @param base iterator over the input sequence * @param action mapping function to be applied to each item in the input sequence. * @return an iterator over the result sequence * @throws XPathException if (for example) a dynamic error occurs while priming the queue */ public <F extends Item<?>, T extends Item<?>> SequenceIterator<T> getMultithreadedItemMappingIterator( SequenceIterator<F> base, ItemMappingFunction<F, T> action) throws XPathException { return new ItemMappingIterator<>(base, action); }
/** * Get an item mapping iterator suitable for multi-threaded execution, if this is permitted * * @param base iterator over the input sequence * @param action mapping function to be applied to each item in the input sequence. * @return an iterator over the result sequence * @throws XPathException if (for example) a dynamic error occurs while priming the queue */ public <F extends Item<?>, T extends Item<?>> SequenceIterator<T> getMultithreadedItemMappingIterator( SequenceIterator<F> base, ItemMappingFunction<F, T> action) throws XPathException { return new ItemMappingIterator<>(base, action); }
/** * Iterate over the sequence of values */ public SequenceIterator iterate(final XPathContext context) throws XPathException { SequenceIterator base = operand.iterate(context); ItemMappingFunction promoter = new ItemMappingFunction() { public Item map(Item item) throws XPathException { return promote(((AtomicValue)item), context); } }; return new ItemMappingIterator(base, promoter); }
/** * 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 map(Item item) throws XPathException { return ((AtomicValue)item).convert(requiredPrimitiveType, true, context).asAtomic(); } }; return new ItemMappingIterator(base, converter); }
/** * 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 map(Item item) throws XPathException { return ((AtomicValue)item).convert(requiredPrimitiveType, true, context).asAtomic(); } }; return new ItemMappingIterator(base, converter); }
/** * Iterate over the sequence of values */ public SequenceIterator iterate(final XPathContext context) throws XPathException { SequenceIterator base = operand.iterate(context); ItemMappingFunction promoter = new ItemMappingFunction() { public Item map(Item item) throws XPathException { return promote(((AtomicValue)item), context); } }; return new ItemMappingIterator(base, promoter); }
/** * 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 map(Item item) throws XPathException { return ((AtomicValue)item).convert(requiredPrimitiveType, true, context).asAtomic(); } }; return new ItemMappingIterator(base, converter); }
public SequenceIterator getAnother() throws XPathException { return new ItemMappingIterator(base.getAnother(), action); }
public static SequenceIterator<?> snapshotSequence(SequenceIterator<?> nodes, final XPathContext context) { return new ItemMappingIterator(nodes, getMappingFunction()); }
public static SequenceIterator<?> snapshotSequence(SequenceIterator<?> nodes, final XPathContext context) { return new ItemMappingIterator(nodes, getMappingFunction()); }
public SequenceIterator getAnother() throws XPathException { return new ItemMappingIterator(base.getAnother(), action); }
/** * Iterate over the sequence of values */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator base = operand.iterate(context); ItemCheckMappingFunction map = new ItemCheckMappingFunction(); map.externalContext = context; return new ItemMappingIterator(base, map); }
/** * Iterate over the sequence of values */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator base = operand.iterate(context); ItemCheckMappingFunction map = new ItemCheckMappingFunction(); map.externalContext = context; return new ItemMappingIterator(base, map); }
/** * Iterate over the sequence of values */ public SequenceIterator iterate(XPathContext context) throws XPathException { SequenceIterator base = operand.iterate(context); ItemCheckMappingFunction map = new ItemCheckMappingFunction(); map.externalContext = context; return new ItemMappingIterator(base, map); }
/** * Return an Iterator to iterate over the values of a sequence. The value of every * expression can be regarded as a sequence, so this method is supported for all * expressions. * * @param context supplies the context for evaluation * @return a SequenceIterator that can be used to iterate over the result * of the expression * @throws net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the * expression */ @Override public SequenceIterator<?> iterate(XPathContext context) throws XPathException { return new ItemMappingIterator(getBaseExpression().iterate(context), this); }
/** * Return an Iterator to iterate over the values of a sequence. The value of every * expression can be regarded as a sequence, so this method is supported for all * expressions. * * @param context supplies the context for evaluation * @return a SequenceIterator that can be used to iterate over the result * of the expression * @throws net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the * expression */ @Override public SequenceIterator<?> iterate(XPathContext context) throws XPathException { return new ItemMappingIterator(getBaseExpression().iterate(context), this); }
/** * Iterate over the sequence of values */ /*@NotNull*/ public SequenceIterator<?> iterate(XPathContext context) throws XPathException { SequenceIterator<?> base = getBaseExpression().iterate(context); return new ItemMappingIterator<>(base, getMappingFunction(context), true); }
/** * Iterate over the sequence of values */ /*@NotNull*/ public SequenceIterator<?> iterate(XPathContext context) throws XPathException { SequenceIterator<?> base = getBaseExpression().iterate(context); return new ItemMappingIterator<>(base, getMappingFunction(context), true); }
public void checkWindowContents(Window w) throws XPathException { if (windowMustBeSingleton && w.contents.size() > 1) { throw new XPathException("Required type of window allows only a single item; window has length " + w.contents.size(), "XPTY0004", getLocation()); } ItemTypeCheckingFunction<Item<?>> checker = getItemTypeChecker(); if (checker != null) { SequenceIterator<?> check = new ItemMappingIterator<>(new ListIterator<>(w.contents), checker); Count.count(check); // a convenient way to consume the iterator and thus perform the checking } }
public void checkWindowContents(Window w) throws XPathException { if (windowMustBeSingleton && w.contents.size() > 1) { throw new XPathException("Required type of window allows only a single item; window has length " + w.contents.size(), "XPTY0004", getLocation()); } ItemTypeCheckingFunction<Item<?>> checker = getItemTypeChecker(); if (checker != null) { SequenceIterator<?> check = new ItemMappingIterator<>(new ListIterator<>(w.contents), checker); Count.count(check); // a convenient way to consume the iterator and thus perform the checking } }