net.sf.saxon.pattern
Class KeyPattern

java.lang.Object
  |
  +--net.sf.saxon.pattern.Pattern
        |
        +--net.sf.saxon.pattern.KeyPattern
All Implemented Interfaces:
Container, java.io.Serializable, javax.xml.transform.SourceLocator

public final class KeyPattern
extends Pattern

A KeyPattern is a pattern of the form key(keyname, keyvalue)

See Also:
Serialized Form

Constructor Summary
KeyPattern(int namecode, Expression key)
          Constructor
 
Method Summary
 NodeTest getNodeTest()
          Get a NodeTest that all the nodes matching this pattern must satisfy
 boolean matches(NodeInfo e, XPathContext context)
          Determine whether this Pattern matches the given Node.
 Pattern typeCheck(StaticContext env, ItemType contextItemType)
          Type-check the pattern.
 
Methods inherited from class net.sf.saxon.pattern.Pattern
getColumnNumber, getDefaultPriority, getExecutable, getFingerprint, getLineNumber, getNodeKind, getPublicId, getSystemId, internalMatches, make, setExecutable, setLineNumber, setOriginalText, setSystemId, simplify, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyPattern

public KeyPattern(int namecode,
                  Expression key)
Constructor

Parameters:
namecode - the name of the key
key - the value of the key
Method Detail

typeCheck

public Pattern typeCheck(StaticContext env,
                         ItemType contextItemType)
                  throws XPathException
Type-check the pattern. This is needed for patterns that contain variable references or function calls.

Overrides:
typeCheck in class Pattern
Returns:
the optimised Pattern
XPathException

matches

public boolean matches(NodeInfo e,
                       XPathContext context)
                throws XPathException
Determine whether this Pattern matches the given Node.

Specified by:
matches in class Pattern
Parameters:
e - The NodeInfo representing the Element or other node to be tested against the Pattern
context - The dynamic context. Only relevant if the pattern uses variables, or contains calls on functions such as document() or key().
Returns:
true if the node matches the Pattern, false otherwise
XPathException

getNodeTest

public NodeTest getNodeTest()
Get a NodeTest that all the nodes matching this pattern must satisfy

Specified by:
getNodeTest in class Pattern