com.novell.xml.xpath
Class Predicate

java.lang.Object
  extended bycom.novell.xml.xpath.Predicate
All Implemented Interfaces:
ContextNodeList

public class Predicate
extends Object
implements ContextNodeList

Class that represents a predicate in a Step or in a FilterExpr


Field Summary
 
Fields inherited from interface com.novell.xml.xpath.ContextNodeList
DOCUMENT_ORDER, REVERSE_DOCUMENT_ORDER, UNKNOWN_ORDER
 
Constructor Summary
Predicate(Expression expr)
          Create a Predicate with the given expression
 
Method Summary
 int count()
          Return a count of nodes in the context node list that match the predicate expression
 void done()
          stop referencing resources that are no longer needed
 Node first()
          Return the first node from the context node list that matches the predicate expression
 ContextListMark getMark()
          Return a marker to a position in a ContextNodeList.
 Node next()
          Return subsequent nodesfrom the context node list that match the predicate expression
 int order()
          Return order in which nodes are returned from first()-next()
 int position()
          Return the position of the last node returned by a call to first() or next()
 Node returnToMark(ContextListMark mark)
          Go to a position in a ContextNodeList previously marked with getMark()
 void setup(ExpressionContext context)
          Setup the Predicate for first()/next() calls The Predicate uses the ContextNodeList interface of the ExpressionContext to get the nodes to test.
 String toString()
          Provide a readable description for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Predicate

public Predicate(Expression expr)
Create a Predicate with the given expression

Parameters:
expr - The PredicateExpr expression
Method Detail

toString

public String toString()
Provide a readable description for debugging.

Returns:
String representation

setup

public void setup(ExpressionContext context)
Setup the Predicate for first()/next() calls The Predicate uses the ContextNodeList interface of the ExpressionContext to get the nodes to test.

Parameters:
context - The expression context for evalulating the PredicateExpr.

done

public void done()
stop referencing resources that are no longer needed


first

public Node first()
           throws XPathEvaluationException
Return the first node from the context node list that matches the predicate expression

Specified by:
first in interface ContextNodeList
Returns:
a node
Throws:
XPathEvaluationException

next

public Node next()
          throws XPathEvaluationException
Return subsequent nodesfrom the context node list that match the predicate expression

Specified by:
next in interface ContextNodeList
Returns:
a node
Throws:
XPathEvaluationException

position

public int position()
Return the position of the last node returned by a call to first() or next()

Specified by:
position in interface ContextNodeList
Returns:
Node position in node list. 0 is returned if no nodes have been returned. Once first() or next() return null (indicating no more nodes in list) the return will be the position of the last node in the list.

count

public int count()
          throws XPathEvaluationException
Return a count of nodes in the context node list that match the predicate expression

Specified by:
count in interface ContextNodeList
Returns:
Count of nodes in the context node list.
Throws:
XPathEvaluationException

order

public int order()
Return order in which nodes are returned from first()-next()

Specified by:
order in interface ContextNodeList
Returns:
DOCUMENT_ORDER or REVERSE_DOCUMENT_ORDER

getMark

public ContextListMark getMark()
Return a marker to a position in a ContextNodeList. This marker can be used later in a call to returnToMark() to return to a particular position in the list.

Specified by:
getMark in interface ContextNodeList
Returns:
an opaque marker

returnToMark

public Node returnToMark(ContextListMark mark)
Go to a position in a ContextNodeList previously marked with getMark()

Specified by:
returnToMark in interface ContextNodeList
Parameters:
mark - mark returned from getMark()
Returns:
The node at the mark