net.sf.saxon.pattern

## Class ExceptPattern

- java.lang.Object
- - net.sf.saxon.pattern.Pattern
  - - net.sf.saxon.pattern.VennPattern
    - - net.sf.saxon.pattern.ExceptPattern

- All Implemented Interfaces:
    Serializable, SourceLocator, Container, PatternFinder

      public class ExceptPattern
      extends VennPattern

  A pattern formed as the difference of two other patterns
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.pattern.VennPattern

      `p1, p2`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExceptPattern(Pattern p1, Pattern p2)` Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)` Determine whether this pattern is the same as another pattern
    `ItemType` | `getItemType()` Get an ItemType that all the items matching this pattern must satisfy
    `int` | `hashCode()` Hashcode supporting equals()
    `boolean` | `matches(Item item, XPathContext context)` Determine if the supplied node matches the pattern
    `boolean` | `matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context)` Determine whether this pattern matches a given Node within the subtree rooted at a given anchor node.

    - ### Methods inherited from class net.sf.saxon.pattern.VennPattern

      `allocateSlots, analyze, bindCurrent, gatherComponentPatterns, getDependencies, getLHS, getNodeKind, getRHS, isMotionless, iterateSubExpressions, promote, replaceSubExpression, setExecutable, setLineNumber, setOriginalText, setSystemId, simplify`

    - ### Methods inherited from class net.sf.saxon.pattern.Pattern

      `getColumnNumber, getContainerGranularity, getDefaultPriority, getExecutable, getFingerprint, getHostLanguage, getLineNumber, getLocationProvider, getPublicId, getSystemId, make, replaceCurrent, selectNodes, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ExceptPattern

          public ExceptPattern(Pattern p1,
                       Pattern p2)

      Constructor
      Parameters:
        `p1` - the left-hand operand
        `p2` - the right-hand operand

  - ### Method Detail

    - #### getItemType

          public ItemType getItemType()

      Get an ItemType that all the items matching this pattern must satisfy
      Overrides:
        `getItemType` in class `VennPattern`
      Returns:
        an ItemType, as specific as possible, which all the matching items satisfy

    - #### matches

          public boolean matches(Item item,
                        XPathContext context)
                          throws XPathException

      Determine if the supplied node matches the pattern
      Specified by:
        `matches` in class `Pattern`
      Parameters:
        `item` - the node to be compared
        `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 either of the operand patterns
      Throws:
        `XPathException` - if an error occurs while matching the pattern (the caller will usually treat this the same as a false result)

    - #### matchesBeneathAnchor

          public boolean matchesBeneathAnchor(NodeInfo node,
                                     NodeInfo anchor,
                                     XPathContext context)
                                       throws XPathException

      Determine whether this pattern matches a given Node within the subtree rooted at a given anchor node. This method is used when the pattern is used for streaming.
      Overrides:
        `matchesBeneathAnchor` in class `Pattern`
      Parameters:
        `node` - The NodeInfo representing the Element or other node to be tested against the Pattern
        `anchor` - The anchor node, which must match any AnchorPattern subpattern
        `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` - if an error occurs while matching the pattern (the caller will usually treat this the same as a false result)

    - #### equals

          public boolean equals(Object other)

      Determine whether this pattern is the same as another pattern
      Overrides:
        `equals` in class `VennPattern`
      Parameters:
        `other` - the other object

    - #### hashCode

          public int hashCode()

      Hashcode supporting equals()
      Overrides:
        `hashCode` in class `VennPattern`

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