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 Patternp1
protected Patternp2
Constructor Summary
UnionPattern(Pattern p1, Pattern p2)
Constructor
Method Summary
PatterngetLHS()
Get the LHS of the union
shortgetNodeType()
Determine the types of nodes to which this pattern applies.
PatterngetRHS()
Get the RHS of the union
booleanmatches(NodeInfo e, Context c)
Determine if the supplied node matches the pattern
voidsetOriginalText(String pattern)
Set the original text
Patternsimplify()
Simplify the pattern: perform any context-independent optimisations

Field Detail

p1

protected Pattern p1

p2

protected Pattern p2

Constructor Detail

UnionPattern

public UnionPattern(Pattern p1, Pattern p2)
Constructor

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

Method Detail

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

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)
Determine if the supplied node matches the pattern

Returns: true if the node matches either of the operand patterns

UNKNOWN: the node to be compared

setOriginalText

public void setOriginalText(String pattern)
Set the original text

simplify

public Pattern simplify()
Simplify the pattern: perform any context-independent optimisations