com.caucho.xpath.pattern
Class UnionPattern

java.lang.Object
  extended by com.caucho.xpath.pattern.AbstractPattern
      extended by com.caucho.xpath.pattern.UnionPattern

public class UnionPattern
extends AbstractPattern

Implementation of the 'a|b' pattern. It's made public so XSLT can separate the left and right sides.


Field Summary
 
Fields inherited from class com.caucho.xpath.pattern.AbstractPattern
_child, _parent, log, XMLNS
 
Constructor Summary
UnionPattern(AbstractPattern left, AbstractPattern right)
           
 
Method Summary
 int count(org.w3c.dom.Node node, Env env, AbstractPattern pattern)
          Returns the number of nodes in its context for a match pattern.
 NodeIterator createNodeIterator(org.w3c.dom.Node node, ExprEnvironment env, AbstractPattern match)
          Creates a new node iterator.
 AbstractPattern getLeft()
          Return left node of the union.
 AbstractPattern getRight()
          Return right node of the union.
 boolean isStrictlyAscending()
          Returns true if the nodes are ascending.
 boolean match(org.w3c.dom.Node node, ExprEnvironment env)
          Match if either pattern matches.
 int position(org.w3c.dom.Node node, Env env, AbstractPattern pattern)
          Returns the position of the node in its context for a match pattern.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.xpath.pattern.AbstractPattern
copyAxis, copyPosition, findAny, firstNode, getNodeName, getParent, getPrefix, getPriority, isAscending, isUnique, lastNode, nextNode, select, selectUnique, toPatternString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnionPattern

public UnionPattern(AbstractPattern left,
                    AbstractPattern right)
Method Detail

match

public boolean match(org.w3c.dom.Node node,
                     ExprEnvironment env)
              throws XPathException
Match if either pattern matches.

Specified by:
match in class AbstractPattern
Parameters:
node - the node to test
env - the variable environment
Returns:
true if the pattern matches.
Throws:
XPathException

isStrictlyAscending

public boolean isStrictlyAscending()
Returns true if the nodes are ascending.

Overrides:
isStrictlyAscending in class AbstractPattern

createNodeIterator

public NodeIterator createNodeIterator(org.w3c.dom.Node node,
                                       ExprEnvironment env,
                                       AbstractPattern match)
                                throws XPathException
Creates a new node iterator.

Overrides:
createNodeIterator in class AbstractPattern
Parameters:
node - the starting node
env - the xpath environment
match - the axis match pattern
Returns:
the node iterator
Throws:
XPathException

position

public int position(org.w3c.dom.Node node,
                    Env env,
                    AbstractPattern pattern)
             throws XPathException
Description copied from class: AbstractPattern
Returns the position of the node in its context for a match pattern.

Overrides:
position in class AbstractPattern
Parameters:
node - the current node
env - the variable environment
pattern - the position pattern
Returns:
the node's position.
Throws:
XPathException

count

public int count(org.w3c.dom.Node node,
                 Env env,
                 AbstractPattern pattern)
          throws XPathException
Description copied from class: AbstractPattern
Returns the number of nodes in its context for a match pattern.

Overrides:
count in class AbstractPattern
Parameters:
node - the current node
env - the variable environment
pattern - the position pattern
Returns:
the count of nodes in the match selection
Throws:
XPathException

getLeft

public AbstractPattern getLeft()
Return left node of the union.


getRight

public AbstractPattern getRight()
Return right node of the union.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object