Class Step<T extends XdmItem>

java.lang.Object
net.sf.saxon.s9api.streams.Step<T>
Type Parameters:
T - the type of XdmItem that is returned by the step. (Note that we don't parameterize Steps by the type of input item).
All Implemented Interfaces:
Function<XdmItem,Stream<? extends T>>

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    at(long index)
    Obtain a step that selects the Nth item in the results of this step
    cat(Step<T> other)
    Obtain a Step that concatenates the results of this Step with the result of another Step applied to the same input item.
    Obtain a step that selects the first item in the results of this step
    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 step
    where(Predicate<? super T> predicate)
    Obtain a Step that filters the results of this Step using a supplied predicate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, apply, compose
  • Constructor Details

    • Step

      public Step()
  • Method Details

    • where

      public Step<T> where(Predicate<? super T> predicate)
      Obtain a Step 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 a Step 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 flatMap() function or the XPath ! operator: there is no sorting of nodes into document order, and no elimination of duplicates.