## net.sf.saxon.pattern
Class NodeTestPattern

    java.lang.Object
      |
      +--net.sf.saxon.pattern.Pattern
            |
            +--net.sf.saxon.pattern.NodeTestPattern

All Implemented Interfaces:
  Container, java.io.Serializable, javax.xml.transform.SourceLocator

public class NodeTestPattern
extends Pattern

A NodeTestPattern is a pattern that consists simply of a NodeTest.

See Also:
  Serialized Form

Constructor Summary
`NodeTestPattern()`
`NodeTestPattern(NodeTest test)`

Method Summary
`double` `getDefaultPriority()` Determine the default priority of this node test when used on its own as a Pattern
`int` `getFingerprint()` Determine the name fingerprint of nodes to which this pattern applies.
`int` `getNodeKind()` Determine the types of nodes to which this pattern applies.
`NodeTest` `getNodeTest()` Get a NodeTest that all the nodes matching this pattern must satisfy
`boolean` `matches(NodeInfo node, XPathContext context)` Determine whether this Pattern matches the given Node.
`void` `setNodeTest(NodeTest test)`

Methods inherited from class net.sf.saxon.pattern.Pattern
`getColumnNumber, getExecutable, getLineNumber, getPublicId, getSystemId, internalMatches, make, setExecutable, setLineNumber, setOriginalText, setSystemId, simplify, toString, typeCheck`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NodeTestPattern

    public NodeTestPattern()

### NodeTestPattern

    public NodeTestPattern(NodeTest test)

Method Detail

### setNodeTest

    public void setNodeTest(NodeTest test)

### 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

  Specified by:
    `matches` in class `Pattern`
  Parameters:
    `node` - The NodeInfo representing the Element or other node to be tested against the Pattern
    `context` - 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
  Returns:
    true if the node matches the Pattern, false otherwise

### getNodeTest

    public NodeTest getNodeTest()

  Get a NodeTest that all the nodes matching this pattern must satisfy

  Specified by:
    `getNodeTest` in class `Pattern`

### getDefaultPriority

    public final double getDefaultPriority()

  Determine the default priority of this node test when used on its own as a Pattern

  Overrides:
    `getDefaultPriority` in class `Pattern`

### 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

  Overrides:
    `getNodeKind` in class `Pattern`
  Returns:
    the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT

### getFingerprint

    public int getFingerprint()

  Determine the name fingerprint of nodes to which this pattern applies. Used for optimisation.

  Overrides:
    `getFingerprint` in class `Pattern`
  Returns:
    A fingerprint that the nodes must match, or -1 if it can match multiple fingerprints