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).
public abstract class Step<T extends XdmItem>
extends Object
implements Function<XdmItem,Stream<? extends T>>
A
Step
is a function that can be applied to an item
to return a stream of items.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionat
(long index) Obtain a step that selects the Nth item in the results of this stepObtain aStep
that concatenates the results of this Step with the result of another Step applied to the same input item.first()
Obtain a step that selects the first item in the results of this steplast()
Obtain a step that selects the last item in the results of this stepObtain a step that combines the results of this step with the results of another stepObtain aStep
that filters the results of this Step using a supplied predicate.
-
Constructor Details
-
Step
public Step()
-
-
Method Details
-
where
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
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
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
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
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
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
flatMap()
function or the XPath!
operator: there is no sorting of nodes into document order, and no elimination of duplicates.
-