public class NodeSelector extends NodeTest
This is needed for C#, where it is not possible for a method such as NodeInfo.iterateAxis(int, NodePredicate)
to accept either a NodeTest object or a Predicate supplied as a lambda expression. To supply a predicate, it is
therefore necessary to wrap it in a NodePredicate
.
Modifier and Type | Method and Description |
---|---|
double |
getDefaultPriority()
Determine the default priority to use if this node-test appears as a match pattern
for a template with no explicit priority attribute.
|
UType |
getUType()
Get the corresponding
UType . |
boolean |
matches(int nodeKind,
NodeName name,
SchemaType annotation)
Test whether this node test is satisfied by a given node.
|
static NodeSelector |
of(java.util.function.Predicate<? super NodeInfo> predicate)
Create a NodeTest based on a supplied predicate.
|
boolean |
test(NodeInfo node)
Test whether this node test is satisfied by a given node.
|
copy, explainMismatch, getAtomizedItemType, getBasicAlphaCode, getContentType, getFingerprint, getGenre, getMatcher, getMatchingNodeName, getPrimitiveItemType, getPrimitiveType, getRequiredNodeNames, isAtomicType, isAtomizable, isNillable, isPlainType, matches, one, oneOrMore, toShortString, zeroOrMore, zeroOrOne
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFullAlphaCode, getNormalizedDefaultPriority, toExportString
public static NodeSelector of(java.util.function.Predicate<? super NodeInfo> predicate)
predicate
- the supplied predicate (a boolean function of a node)public boolean test(NodeInfo node)
NodeTest
NodeTest.matches(int, NodeName, SchemaType)
test
in interface NodePredicate
test
in class NodeTest
node
- the node to be matchedpublic double getDefaultPriority()
NodeTest
getDefaultPriority
in interface ItemType
getDefaultPriority
in class NodeTest
public boolean matches(int nodeKind, NodeName name, SchemaType annotation)
NodeTest
matches
in class NodeTest
nodeKind
- The kind of node to be matchedname
- identifies the expanded name of the node to be matched.
The value should be null for a node with no name.annotation
- The actual content type of the node. Null means no constraint.Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.