com.icl.saxon.pattern

Class NameTest


public class NameTest
extends NodeTest

NodeTest is an interface that enables a test of whether a node has a particular name and type. A NameTest matches the node type and the namespace URI and the local name.
Author:
Michael H. Kay

Field Summary

Fields inherited from class com.icl.saxon.pattern.Pattern

originalText, staticContext

Constructor Summary

NameTest(NodeInfo node)
Create a NameTest for nodes of the same type and name as a given node
NameTest(short nodeType, int nameCode)

Method Summary

double
getDefaultPriority()
Determine the default priority of this node test when used on its own as a Pattern
int
getFingerprint()
Get the fingerprint required
short
getNodeType()
Determine the types of nodes to which this pattern applies.
boolean
matches(NodeInfo node)
Test whether this node test is satisfied by a given node
boolean
matches(short nodeType, int nameCode)
Test whether this node test is satisfied by a given node

Methods inherited from class com.icl.saxon.pattern.NodeTest

matches, matches, matches

Methods inherited from class com.icl.saxon.pattern.Pattern

getDefaultPriority, getFingerprint, getLineNumber, getNodeType, getStaticContext, getSystemId, make, matches, setOriginalText, setStaticContext, simplify, toString

Constructor Details

NameTest

public NameTest(NodeInfo node)
Create a NameTest for nodes of the same type and name as a given node

NameTest

public NameTest(short nodeType,
                int nameCode)

Method Details

getDefaultPriority

public final double getDefaultPriority()
Determine the default priority of this node test when used on its own as a Pattern
Overrides:
getDefaultPriority in interface Pattern

getFingerprint

public int getFingerprint()
Get the fingerprint required
Overrides:
getFingerprint in interface Pattern

getNodeType

public short getNodeType()
Determine the types of nodes to which this pattern applies. Used for optimisation. For patterns that match nodes of several types, return NodeInfo.NODE
Overrides:
getNodeType in interface Pattern
Returns:
the type of node matched by this pattern. e.g. NodeInfo.ELEMENT or NodeInfo.TEXT

matches

public final boolean matches(NodeInfo node)
Test whether this node test is satisfied by a given node
Overrides:
matches in interface NodeTest

matches

public boolean matches(short nodeType,
                       int nameCode)
Test whether this node test is satisfied by a given node
Overrides:
matches in interface NodeTest
Parameters:
nodeType - The type of node to be matched