com.caucho.xpath.pattern
Class FilterPattern

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

public class FilterPattern
extends AbstractPattern

matches a node if it matches a filter expression. Filter implements the a[b] pattern.


Field Summary
 
Fields inherited from class com.caucho.xpath.pattern.AbstractPattern
_child, _parent, log, XMLNS
 
Constructor Summary
FilterPattern(AbstractPattern parent, Expr expr)
           
 
Method Summary
 AbstractPattern copyPosition()
          Returns the position matching pattern.
 NodeIterator createNodeIterator(org.w3c.dom.Node node, ExprEnvironment env, AbstractPattern match)
          Creates a new node iterator.
 Expr getExpr()
          Returns the filter's expression.
 java.lang.String getNodeName()
          Returns the name of the matching node or '*' if many nodes match.
 boolean match(org.w3c.dom.Node node, ExprEnvironment env)
          Matches if the filter expression matches.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.xpath.pattern.AbstractPattern
copyAxis, count, findAny, firstNode, getParent, getPrefix, getPriority, isAscending, isStrictlyAscending, isUnique, lastNode, nextNode, position, select, selectUnique, toPatternString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilterPattern

public FilterPattern(AbstractPattern parent,
                     Expr expr)
Method Detail

getNodeName

public java.lang.String getNodeName()
Description copied from class: AbstractPattern
Returns the name of the matching node or '*' if many nodes match.

The Xsl package uses this to speed template matching.

Overrides:
getNodeName in class AbstractPattern

getExpr

public Expr getExpr()
Returns the filter's expression.


match

public boolean match(org.w3c.dom.Node node,
                     ExprEnvironment env)
              throws XPathException
Matches if the filter expression matches. When the filter expression returns a number, match if the position() equals the expression.

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

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 variable environment
match - the axis match pattern
Returns:
the node iterator
Throws:
XPathException

copyPosition

public AbstractPattern copyPosition()
Description copied from class: AbstractPattern
Returns the position matching pattern.

Overrides:
copyPosition in class AbstractPattern

toString

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