com.caucho.xpath.pattern
Class FromAncestors

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

public class FromAncestors
extends AbstractPattern

Implements the ancestor:: axis.


Field Summary
 
Fields inherited from class com.caucho.xpath.pattern.AbstractPattern
_child, _parent, log, XMLNS
 
Constructor Summary
FromAncestors(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 number of matching ancestors from the axis context
 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 isAscending()
          Return true if the iterator is in document-order.
 boolean isStrictlyAscending()
          Returns true if the pattern is strictly ascending.
 boolean isUnique()
          Returns true if the pattern's selector returns unique nodes.
 boolean match(org.w3c.dom.Node node, ExprEnvironment env)
          Matches if a descendant matches the parent pattern.
 org.w3c.dom.Node nextNode(org.w3c.dom.Node node, org.w3c.dom.Node last)
          Returns the next node in the selection order.
 int position(org.w3c.dom.Node node, Env env, AbstractPattern pattern)
          The ancestor position is the number of matching nodes between it and an axis-context.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.xpath.pattern.AbstractPattern
findAny, getNodeName, getParent, getPrefix, getPriority, lastNode, select, selectUnique, toPatternString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FromAncestors

public FromAncestors(AbstractPattern parent,
                     boolean self)
Method Detail

match

public boolean match(org.w3c.dom.Node node,
                     ExprEnvironment env)
              throws XPathException
Matches if a descendant matches the parent pattern.

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

isAscending

public boolean isAscending()
Description copied from class: AbstractPattern
Return true if the iterator is in document-order.

Overrides:
isAscending in class AbstractPattern

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 last)
Returns the next node in the selection order.

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

position

public int position(org.w3c.dom.Node node,
                    Env env,
                    AbstractPattern pattern)
             throws XPathException
The ancestor position is the number of matching nodes between it and an axis-context.

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)
counts the number of matching ancestors from the axis context

Parameters:
node - the current node
env - the variable environment
pattern - the position pattern
Returns:
the count of the node list.

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

isStrictlyAscending

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

Overrides:
isStrictlyAscending in class AbstractPattern

isUnique

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

Overrides:
isUnique in class AbstractPattern