Class ExceptPattern

    • 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
        Specified by:
        getItemType in class Pattern
        Returns:
        an ItemType, as specific as possible, which all the matching items satisfy
      • getUType

        public UType getUType()
        Get a UType indicating which kinds of items this Pattern can match.
        Specified by:
        getUType in class Pattern
        Returns:
        a UType indicating all the primitive types of item that the pattern can match.
      • getDefaultPriority

        public double getDefaultPriority()
        The default priority of an "except" pattern is the priority of the LH operand
        Overrides:
        getDefaultPriority in class Pattern
        Returns:
        the priority of the LH operand
      • 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.
        Returns:
        true if the node matches either of the operand patterns
        Throws:
        XPathException - if an error occurs while matching the pattern
      • 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)
      • convertToTypedPattern

        public Pattern convertToTypedPattern​(java.lang.String val)
                                      throws XPathException
        Convert the pattern to a typed pattern, in which an element name is treated as schema-element(N)
        Overrides:
        convertToTypedPattern in class Pattern
        Parameters:
        val - either "strict" or "lax" depending on the value of xsl:mode/@typed
        Returns:
        either the original pattern unchanged, or a new pattern as the result of the conversion
        Throws:
        XPathException - if the pattern cannot be converted
      • equals

        public boolean equals​(java.lang.Object other)
        Determine whether this pattern is the same as another pattern
        Overrides:
        equals in class VennPattern
        Parameters:
        other - the other object
        Returns:
        true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
      • computeHashCode

        protected int computeHashCode()
        Hashcode supporting equals()
        Overrides:
        computeHashCode in class VennPattern
        Returns:
        a computed hash code
      • getOperatorName

        protected java.lang.String getOperatorName()
        Get the relevant operator: "union", "intersect", or "except"
        Specified by:
        getOperatorName in class VennPattern
        Returns:
        the operator, as a string
      • copy

        public Pattern copy​(RebindingMap rebindings)
        Copy a pattern. This makes a deep copy.
        Specified by:
        copy in class Pattern
        Parameters:
        rebindings - variables that need to be re-bound
        Returns:
        the copy of the original pattern