Package eu.bandm.tools.paisley.xml
Interface XPathPatterns.Predicate
- Enclosing class:
XPathPatterns
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Representation of an XPath predicate.
XPath predicates differ from generic predicates (Predicate) and patterns (Pattern) in that they
do not apply to an element in isolation, but always as an element of a
node-set; both the position of the element and the total size of the
node-set may be observed.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns a motif that filters the node-set implied by the given motif with this predicate.booleanselects(IntSupplier size, int position, Node node) Checks whether the element at a given position in a node-set is to be selected.
-
Method Details
-
selects
Checks whether the element at a given position in a node-set is to be selected.The result may not only depend on the element itself, but also on its position and the total number of elements. The latter is computed lazily on demand, because it may trigger upstream lazy computation of all remaining elements.
- Parameters:
size- a lazy computation of the total number of elements in the node-setposition- the one-based position of the element in the node-setnode- an element of the node-set- Returns:
trueif the element is to be selected;falseotherwise
-
apply
Returns a motif that filters the node-set implied by the given motif with this predicate.The resulting motif, for a given context node, collects the bindings of the given motif lazily in a node-set, and matches the hole disjunctively against the elements filtered by this predicate.
- Parameters:
base- the motif to postprocess by filtering- Returns:
- a motif that filters the node-set implied by
basewith this predicate - Throws:
NullPointerException- ifbaseis null
-