org.exist.xpath
Interface Expression

All Known Implementing Classes:
FLWR, IntNumber, Literal, PathExpr, Step

public interface Expression

This is the base interface implemented by all classes which are part of an xpath-expression.


Method Summary
 Value eval(DocumentSet docs, NodeSet context, NodeProxy node)
          Evaluate the expression represented by this object.
 java.lang.String pprint()
          Return a readable representation of this expression.
 DocumentSet preselect(DocumentSet in_docs)
          Determine the documents, taken from in_docs, for which this expression will possibly yield a result.
 int returnsType()
          The type of value, this expression returns.
 void setInPredicate(boolean inPredicate)
          This method is called to inform the expression object that it is executed inside an XPath predicate.
 

Method Detail

eval

public Value eval(DocumentSet docs,
                  NodeSet context,
                  NodeProxy node)
Evaluate the expression represented by this object. Depending on the context in which this expression is executed, either context, node or both of them may be set. An implementing class should know how to handle this. Most classes only expect context to contain a list of nodes which represents the current context of this expression.

Parameters:
docs - the set of documents all nodes belong to.
context - the node-set which defines the current context node-set.
node - a single node, taken from context. This defines the node, the expression should work on.

preselect

public DocumentSet preselect(DocumentSet in_docs)
Determine the documents, taken from in_docs, for which this expression will possibly yield a result. An expression does not have to do anything here. It may simply return in_docs. This method is used to restrict the range of documents in question for a given xpath-expression. It is called before the xpath-expression is actually executed.


returnsType

public int returnsType()
The type of value, this expression returns. Depending on the type of expression, this method should return one of the constants defined in class Constants, e.g. TYPE_NODELIST, TYPE_STRING, TYPE_NUM, TYPE_BOOL.


setInPredicate

public void setInPredicate(boolean inPredicate)
This method is called to inform the expression object that it is executed inside an XPath predicate.

Parameters:
inPredicate -

pprint

public java.lang.String pprint()
Return a readable representation of this expression. This method is called whenever the xpath-query should be displayed to the user.



Copyright (C) Wolfgang Meier. All rights reserved.