## net.sf.saxon.pattern
Class IDPattern

    java.lang.Object
      net.sf.saxon.pattern.Pattern
          net.sf.saxon.pattern.NodeSetPattern
              net.sf.saxon.pattern.IDPattern

All Implemented Interfaces:
  Serializable, SourceLocator, Container, PatternFinder

    public final class IDPattern

extends NodeSetPattern

An IDPattern is a pattern of the form id("literal") or id($variable)

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.pattern.NodeSetPattern
`expression, itemType`

Constructor Summary
`IDPattern(Expression id, Configuration config)` Create an id pattern.

Method Summary
`Pattern` `analyze(ExpressionVisitor visitor, ItemType contextItemType)` Type-check the pattern.
`int` `getNodeKind()` Determine the type of nodes to which this pattern applies.
`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

Methods inherited from class net.sf.saxon.pattern.NodeSetPattern
`allocateSlots, equals, getDependencies, hashCode, iterateSubExpressions, promote, replaceSubExpression`

Methods inherited from class net.sf.saxon.pattern.Pattern
`getColumnNumber, getContainerGranularity, getDefaultPriority, getExecutable, getFingerprint, getHostLanguage, getLineNumber, getLocationProvider, getPublicId, getSystemId, internalMatches, make, makeSearchExpression, matchesBeneathAnchor, resolveCurrent, selectNodes, setExecutable, setLineNumber, setOriginalText, setSystemId, simplify, toString`

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

Constructor Detail

### IDPattern

    public IDPattern(Expression id,
                     Configuration config)

  Create an id pattern.

  Parameters:
    `id` - Either a StringValue or a VariableReference

Method Detail

### analyze

    public Pattern analyze(ExpressionVisitor visitor,
                           ItemType contextItemType)
                    throws XPathException

  Type-check the pattern. Default implementation does nothing. This is only needed for patterns that contain variable references or function calls.

  Overrides:
    `analyze` in class `NodeSetPattern`
  Parameters:
    `visitor` - the expression visitor
    `contextItemType` - the type of the context item at the point where the pattern is defined. Set to null if it is known that the context item is undefined.
  Returns:
    the optimised Pattern
  Throws:
    `XPathException`

### matches

    public boolean matches(NodeInfo e,
                           XPathContext context)
                    throws XPathException

  Determine whether this Pattern matches the given Node

  Overrides:
    `matches` in class `NodeSetPattern`
  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
  Throws:
    `XPathException`

### getNodeKind

    public int getNodeKind()

  Determine the type of nodes to which this pattern applies.

  Overrides:
    `getNodeKind` in class `NodeSetPattern`
  Returns:
    Type.ELEMENT

### getNodeTest

    public NodeTest getNodeTest()

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

  Overrides:
    `getNodeTest` in class `NodeSetPattern`
  Returns:
    a NodeTest, as specific as possible, which all the matching nodes satisfy

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.