com.icl.saxon.pattern
Class NamedNodePattern
java.lang.Object
|
+--com.icl.saxon.pattern.Pattern
|
+--com.icl.saxon.pattern.NamedNodePattern
- public class NamedNodePattern
- extends Pattern
A NamedNodePattern is a pattern that tests only for the node type and name.
We optimise this as a special case.
Method Summary |
double |
getDefaultPriority()
Determine the default priority to use if this pattern appears as a match pattern
for a template with no explicit priority attribute. |
Name |
getName()
Return the name of nodes that this pattern will match. |
int |
getType()
Determine the type of nodes to which this pattern applies. |
boolean |
isRelative()
Determine if the pattern uses positional filters |
boolean |
matches(NodeInfo node,
Context c)
Determine whether the pattern matches a given node. |
java.lang.String |
toString()
Return the pattern as a string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NamedNodePattern
public NamedNodePattern(int nodeType,
NameTest name)
- Constructor.
- Parameters:
nodeType
- A specific node type such as NodeInfo.ELEMENT or NodeInfo.ATTRIBUTE,name
- The node name. Must not be null. Must be interned.
(For a match on node type only, use NodeTestPattern)
matches
public boolean matches(NodeInfo node,
Context c)
throws org.xml.sax.SAXException
- Determine whether the pattern matches a given node.
- Overrides:
matches
in class Pattern
- Parameters:
node
- the ElementInfo or other node to be tested- Returns:
- true if the pattern matches, else false
getType
public int getType()
- Determine the type of nodes to which this pattern applies.
- Overrides:
getType
in class Pattern
- Returns:
- the node type (e.g. NodeInfo.ELEMENT)
getName
public Name getName()
- Return the name of nodes that this pattern will match.
This is used for quick elimination of patterns that will never match.
- Overrides:
getName
in class Pattern
- Following copied from class:
com.icl.saxon.pattern.Pattern
- Returns:
- A Name that the nodes must possess, or null
Otherwise return null.
toString
public java.lang.String toString()
- Return the pattern as a string
- Overrides:
toString
in class java.lang.Object
isRelative
public boolean isRelative()
- Determine if the pattern uses positional filters
- Overrides:
isRelative
in class Pattern
- Returns:
- false always
getDefaultPriority
public double getDefaultPriority()
- Determine the default priority to use if this pattern appears as a match pattern
for a template with no explicit priority attribute.
- Overrides:
getDefaultPriority
in class Pattern