Package net.sf.saxon.s9api.streams
Class Step<T extends XdmItem>
- java.lang.Object
-
- net.sf.saxon.s9api.streams.Step<T>
-
- Type Parameters:
T
- the type ofXdmItem
that is returned by the step. (Note that we don't parameterize Steps by the type of input item).
- All Implemented Interfaces:
java.util.function.Function<XdmItem,java.util.stream.Stream<? extends T>>
public abstract class Step<T extends XdmItem> extends java.lang.Object implements java.util.function.Function<XdmItem,java.util.stream.Stream<? extends T>>
AStep
is a function that can be applied to an item to return a stream of items.- See Also:
Steps
-
-
Constructor Summary
Constructors Constructor Description Step()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Step<T>
at(long index)
Obtain a step that selects the Nth item in the results of this stepStep<T>
cat(Step<T> other)
Obtain aStep
that concatenates the results of this Step with the result of another Step applied to the same input item.Step<T>
first()
Obtain a step that selects the first item in the results of this stepStep<T>
last()
Obtain a step that selects the last item in the results of this step<U extends XdmItem>
Step<U>then(Step<U> next)
Obtain a step that combines the results of this step with the results of another stepStep<T>
where(java.util.function.Predicate<? super T> predicate)
Obtain aStep
that filters the results of this Step using a supplied predicate.
-
-
-
Method Detail
-
where
public Step<T> where(java.util.function.Predicate<? super T> predicate)
Obtain aStep
that filters the results of this Step using a supplied predicate.For example,
CHILD.where(isText())
returns a Step whose effect is to select the text node children of a supplied element or document node.- Parameters:
predicate
- the predicate which will be applied to the results of this step- Returns:
- a new Step (that is, a function from one Stream of items to another) that filters the results of this step by selecting only the items that satisfy the predicate.
-
cat
public Step<T> cat(Step<T> other)
Obtain aStep
that concatenates the results of this Step with the result of another Step applied to the same input item.For example,
attribute().cat(child())
returns a step whose effect is to select the attributes of a supplied element followed by its children.- Parameters:
other
- the step whose results will be concatenated with the results of this step- Returns:
- a new Step (that is, a function from one Stream of items to another) that concatenates the results of applying this step to the input item, followed by the results of applying the other step to the input item.
-
first
public Step<T> first()
Obtain a step that selects the first item in the results of this step- Returns:
- a new Step (that is, a function from one Stream of items to another) that filters the results of this step by selecting only the first item.
-
last
public Step<T> last()
Obtain a step that selects the last item in the results of this step- Returns:
- a new Step (that is, a function from one Stream of items to another) that filters the results of this step by selecting only the last item.
-
at
public Step<T> at(long index)
Obtain a step that selects the Nth item in the results of this step- Parameters:
index
- the zero-based index of the item to be selected- Returns:
- a new Step (that is, a function from one Stream of items to another) that filters the results of this step by selecting only the items that satisfy the predicate.
-
then
public <U extends XdmItem> Step<U> then(Step<U> next)
Obtain a step that combines the results of this step with the results of another step- Type Parameters:
U
- the static type of the result of the step- Parameters:
next
- the step which will be applied to the results of this step- Returns:
- a new Step (that is, a function from one Stream of items to another) that performs this step and the next step in turn. The result is equivalent to the Java {code flatMap()} function or the XPath {code !} operator: there is no sorting of nodes into document order, and no elimination of duplicates.
-
-