com.caucho.xpath.pattern
Class FromDescendants

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

public class FromDescendants
extends AbstractPattern

Matches any descendant.


Field Summary
 
Fields inherited from class com.caucho.xpath.pattern.AbstractPattern
_child, _parent, log, XMLNS
 
Constructor Summary
FromDescendants(AbstractPattern parent, boolean self)
           
 
Method Summary
 AbstractPattern copyAxis()
          Returns the node itself for the axis.
 AbstractPattern copyPosition()
          Returns null since the axis isn't part of the position pattern.
 int count(org.w3c.dom.Node node, Env env, AbstractPattern pattern)
          Counts the descendant nodes matching the pattern.
 NodeIterator createNodeIterator(org.w3c.dom.Node node, ExprEnvironment env, AbstractPattern match)
          Creates a new node iterator.
 org.w3c.dom.Node firstNode(org.w3c.dom.Node node, ExprEnvironment env)
          Returns the first node in the selection order.
 boolean isStrictlyAscending()
          Returns true if the pattern is strictly ascending.
 boolean isUnique()
          Returns true if the pattern's selector returns unique nodes.
 org.w3c.dom.Node lastNode(org.w3c.dom.Node node)
          Returns the last node in the selection order.
 boolean match(org.w3c.dom.Node node, ExprEnvironment env)
          Matches the current node if it can find a parent node matching the parent pattern.
 org.w3c.dom.Node nextNode(org.w3c.dom.Node node, org.w3c.dom.Node lastNode)
          Returns the next node in the selection order.
 int position(org.w3c.dom.Node node, Env env, AbstractPattern pattern)
          Counts matching nodes between the axis-context and the node
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.xpath.pattern.AbstractPattern
findAny, getNodeName, getParent, getPrefix, getPriority, isAscending, select, selectUnique, toPatternString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FromDescendants

public FromDescendants(AbstractPattern parent,
                       boolean self)
Method Detail

match

public boolean match(org.w3c.dom.Node node,
                     ExprEnvironment env)
              throws XPathException
Matches the current node if it can find a parent node matching the parent pattern.

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

position

public int position(org.w3c.dom.Node node,
                    Env env,
                    AbstractPattern pattern)
             throws XPathException
Counts matching nodes between the axis-context and the node

Parameters:
node - the starting node
env - the xpath environment
pattern - the axis match pattern
Returns:
the index of the position
Throws:
XPathException

count

public int count(org.w3c.dom.Node node,
                 Env env,
                 AbstractPattern pattern)
          throws XPathException
Counts the descendant nodes matching the pattern.

Parameters:
node - the starting node
env - the xpath environment
pattern - the axis match pattern
Returns:
the count of nodes
Throws:
XPathException

isStrictlyAscending

public boolean isStrictlyAscending()
Returns true if the pattern is strictly ascending.


firstNode

public org.w3c.dom.Node firstNode(org.w3c.dom.Node node,
                                  ExprEnvironment env)
Returns the first node in the selection order.

Overrides:
firstNode in class AbstractPattern
Parameters:
node - the current node
Returns:
the first node

nextNode

public org.w3c.dom.Node nextNode(org.w3c.dom.Node node,
                                 org.w3c.dom.Node lastNode)
Returns the next node in the selection order.

Overrides:
nextNode in class AbstractPattern
Parameters:
node - the current node
ndoe - the last node
Returns:
the next node

lastNode

public org.w3c.dom.Node lastNode(org.w3c.dom.Node node)
Returns the last node in the selection order.

Overrides:
lastNode in class AbstractPattern
Parameters:
node - the current node
Returns:
the last node

toString

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

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

copyAxis

public AbstractPattern copyAxis()
Returns the node itself for the axis.

Overrides:
copyAxis in class AbstractPattern

copyPosition

public AbstractPattern copyPosition()
Returns null since the axis isn't part of the position pattern.

Overrides:
copyPosition in class AbstractPattern

isUnique

public boolean isUnique()
Returns true if the pattern's selector returns unique nodes.

Overrides:
isUnique in class AbstractPattern