Class UnionPattern


  • public class UnionPattern
    extends Pattern
    A pattern formed as the union (or) of two other patterns
    • Constructor Detail

      • UnionPattern

        public UnionPattern​(Pattern p1,
                            Pattern p2)
        Constructor
        Parameters:
        p1 - the left-hand operand
        p2 - the right-hand operand
    • Method Detail

      • setOriginalText

        public void setOriginalText​(java.lang.String pattern)
        Set the original text
        Overrides:
        setOriginalText in class Pattern
      • matches

        public boolean matches​(NodeInfo e,
                               Context c)
                        throws XPathException
        Determine if the supplied node matches the pattern
        Specified by:
        matches in class Pattern
        Parameters:
        e - The NodeInfo representing the Element or other node to be tested against the Pattern
        c - The context in which the match is to take place. Only relevant if the pattern uses variables.
        Returns:
        true if the node matches either of the operand patterns
        Throws:
        XPathException
      • getNodeType

        public short getNodeType()
        Determine the types of nodes to which this pattern applies. Used for optimisation. For patterns that match nodes of several types, return Node.NODE
        Overrides:
        getNodeType in class Pattern
        Returns:
        the type of node matched by this pattern. e.g. Node.ELEMENT or Node.TEXT
      • getLHS

        public Pattern getLHS()
        Get the LHS of the union
      • getRHS

        public Pattern getRHS()
        Get the RHS of the union