net.sf.saxon.pattern
Class NodeTestPattern
- Container, PatternFinder, Serializable, SourceLocator
public class NodeTestPattern
A NodeTestPattern is a pattern that consists simply of a NodeTest.
allocateSlots , analyze , getColumnNumber , getDefaultPriority , getDependencies , getExecutable , getFingerprint , getHostLanguage , getLineNumber , getLocationProvider , getNodeKind , getNodeTest , getPublicId , getSystemId , internalMatches , iterateSubExpressions , make , makeSearchExpression , matches , promote , replaceSubExpression , selectNodes , setExecutable , setLineNumber , setOriginalText , setSystemId , simplify , toString |
NodeTestPattern
public NodeTestPattern()
NodeTestPattern
public NodeTestPattern(NodeTest test)
getDefaultPriority
public final double getDefaultPriority()
Determine the default priority of this node test when used on its own as a Pattern
- getDefaultPriority in interface Pattern
getFingerprint
public int getFingerprint()
Determine the name fingerprint of nodes to which this pattern applies. Used for
optimisation.
- getFingerprint in interface Pattern
- A fingerprint that the nodes must match, or -1 if it can match multiple fingerprints
getNodeKind
public int getNodeKind()
Determine the types of nodes to which this pattern applies. Used for optimisation.
For patterns that match nodes of several types, return Type.NODE
- getNodeKind in interface Pattern
- the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT
getNodeTest
public NodeTest getNodeTest()
Get a NodeTest that all the nodes matching this pattern must satisfy
- getNodeTest in interface Pattern
matches
public boolean matches(NodeInfo node,
XPathContext context)
Determine whether this Pattern matches the given Node. This is the main external interface
for matching patterns: it sets current() to the node being tested
- matches in interface Pattern
node
- The NodeInfo representing the Element or other node to be tested against the Patterncontext
- The context in which the match is to take place. Only relevant if the pattern
uses variables, or contains calls on functions such as document() or key(). Not used (and can be
set to null) in the case of patterns that are NodeTests
- true if the node matches the Pattern, false otherwise
setNodeTest
public void setNodeTest(NodeTest test)
toString
public String toString()
Display the pattern for diagnostics
- toString in interface Pattern