com.icl.saxon.pattern

Class UnionPattern


public class UnionPattern
extends Pattern

A pattern formed as the union (or) of two other patterns

Field Summary

protected Pattern
p1
protected Pattern
p2

Fields inherited from class com.icl.saxon.pattern.Pattern

originalText, staticContext

Constructor Summary

UnionPattern(Pattern p1, Pattern p2)
Constructor

Method Summary

Pattern
getLHS()
Get the LHS of the union
short
getNodeType()
Determine the types of nodes to which this pattern applies.
Pattern
getRHS()
Get the RHS of the union
boolean
matches(NodeInfo e, Context c)
Determine if the supplied node matches the pattern
void
setOriginalText(String pattern)
Set the original text
Pattern
simplify()
Simplify the pattern: perform any context-independent optimisations

Methods inherited from class com.icl.saxon.pattern.Pattern

getDefaultPriority, getFingerprint, getLineNumber, getNodeType, getStaticContext, getSystemId, make, matches, setOriginalText, setStaticContext, simplify, toString

Field Details

p1

protected Pattern p1

p2

protected Pattern p2

Constructor Details

UnionPattern

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

Method Details

getLHS

public Pattern getLHS()
Get the LHS of the union

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 interface Pattern
Returns:
the type of node matched by this pattern. e.g. Node.ELEMENT or Node.TEXT

getRHS

public Pattern getRHS()
Get the RHS of the union

matches

public boolean matches(NodeInfo e,
                       Context c)
            throws XPathException
Determine if the supplied node matches the pattern
Overrides:
matches in interface Pattern
Returns:
true if the node matches either of the operand patterns

setOriginalText

public void setOriginalText(String pattern)
Set the original text
Overrides:
setOriginalText in interface Pattern

simplify

public Pattern simplify()
            throws XPathException
Simplify the pattern: perform any context-independent optimisations
Overrides:
simplify in interface Pattern