/** * Get a stream of items by applying a {@link Step} to the items in this value. This operation * is analogous to the {@code Stream.flatMap} operation in Java, or to the "!" operator * in XPath. * * @param step the Step to be applied to the items in this value * @return a Stream of items obtained by replacing each item X in this value by the items obtained * by applying the Step function to X. * @since 9.9 */ public <T extends XdmItem> XdmStream<T> select(Step<T> step) { return stream().flatMapToXdm(step); }
/** * Get a stream of items by applying a {@link Step} to the items in this value. This operation * is analogous to the {@code Stream.flatMap} operation in Java, or to the "!" operator * in XPath. * * @param step the Step to be applied to the items in this value * @return a Stream of items obtained by replacing each item X in this value by the items obtained * by applying the Step function to X. * @since 9.9 */ public <T extends XdmItem> XdmStream<T> select(Step<T> step) { return stream().flatMapToXdm(step); }
public Stream<? extends XdmItem> apply(XdmItem arg) { try { return XdmFunctionItem.this.call(processor, arg).stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } };
public Stream<? extends XdmItem> apply(XdmItem arg) { try { return XdmFunctionItem.this.call(processor, arg).stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } };
@Override public Stream<? extends XdmAtomicValue> apply(XdmItem item) { if (item instanceof XdmAtomicValue) { return Stream.of((XdmAtomicValue)item); } else if (item instanceof XdmNode) { try { return (XdmStream<XdmAtomicValue>) ((XdmNode) item).getTypedValue().stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } else if (item instanceof XdmArray) { try { ArrayItem arrayItem = ((XdmArray)item).getUnderlyingValue(); AtomicSequence data = arrayItem.atomize(); return (XdmStream<XdmAtomicValue>)XdmValue.wrap(data).stream(); } catch (XPathException e) { throw new SaxonApiUncheckedException(new SaxonApiException(e)); } } else { throw new SaxonApiUncheckedException(new SaxonApiException("Cannot atomize supplied value")); } } };
@Override public Stream<? extends XdmAtomicValue> apply(XdmItem item) { if (item instanceof XdmAtomicValue) { return Stream.of((XdmAtomicValue)item); } else if (item instanceof XdmNode) { try { return (XdmStream<XdmAtomicValue>) ((XdmNode) item).getTypedValue().stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } else if (item instanceof XdmArray) { try { ArrayItem arrayItem = ((XdmArray)item).getUnderlyingValue(); AtomicSequence data = arrayItem.atomize(); return (XdmStream<XdmAtomicValue>)XdmValue.wrap(data).stream(); } catch (XPathException e) { throw new SaxonApiUncheckedException(new SaxonApiException(e)); } } else { throw new SaxonApiUncheckedException(new SaxonApiException("Cannot atomize supplied value")); } } };