|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.icl.saxon.expr.Expression
This class serves two purposes: it is an abstract superclass for different kinds of XPath expression, and it contains a static method to invoke the expression parser
Field Summary | |
protected static java.util.Vector |
emptyVector
|
protected StaticContext |
staticContext
|
Constructor Summary | |
Expression()
|
Method Summary | |
boolean |
containsReferences()
Determine whether the expression contains any references to variables |
NodeEnumeration |
enumerate(Context context)
Return an enumeration of nodes in a nodeset. |
abstract Value |
evaluate(Context context)
Evaluate an expression. |
boolean |
evaluateAsBoolean(Context context)
Evaluate an expression as a Boolean. The result of x.evaluateAsBoolean(c) must be equivalent to x.evaluate(c).asBoolean(); but optimisations are possible when it is known that a boolean result is required, especially in the case of a NodeSet. |
NodeSetValue |
evaluateAsNodeSet(Context context)
Evaluate an expression as a NodeSet. |
double |
evaluateAsNumber(Context context)
Evaluate an expression as a Number. The result of x.evaluateAsNumber(c) must be equivalent to x.evaluate(c).asNumber(); but optimisations are possible when it is known that a numeric result is required, especially in the case of a NodeSet. |
java.lang.String |
evaluateAsString(Context context)
Evaluate an expression as a String. The result of x.evaluateAsString(c) must be equivalent to x.evaluate(c).asString(); but optimisations are possible when it is known that a string result is required, especially in the case of a NodeSet. |
int |
getDataType()
Determine the data type of the expression, if possible |
abstract int |
getDependencies()
Determine which aspects of the context the expression depends on. |
StaticContext |
getStaticContext()
Determine the static context used when the expression was parsed |
boolean |
isNumeric()
Determine whether the return the type of the expression is numeric. |
boolean |
isRelative()
Determine whether the value of the expression is dependent on the position of the current node in the current node list or on the size of the current node list. |
static Expression |
make(java.lang.String expression)
Parse an expression using a default compile-time context. |
static Expression |
make(java.lang.String expression,
StaticContext env)
Parse an expression |
abstract Expression |
reduce(int dependencies,
Context context)
Perform a partial evaluation of the expression, by eliminating specified dependencies on the context. |
void |
setStaticContext(StaticContext sc)
Set the static context used when the expression was parsed |
Expression |
simplify()
Simplify an expression. |
boolean |
usesCurrent()
Determine whether the expression uses the current() function. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected StaticContext staticContext
protected static java.util.Vector emptyVector
Constructor Detail |
public Expression()
Method Detail |
public static Expression make(java.lang.String expression, StaticContext env) throws org.xml.sax.SAXException
expression
- The expression (as a character string)env
- An object giving information about the compile-time context of the expressionpublic static Expression make(java.lang.String expression) throws org.xml.sax.SAXException
expression
- The expression (as a character string)env
- An object giving information about the compile-time context of the expressionpublic Expression simplify() throws org.xml.sax.SAXException
public final void setStaticContext(StaticContext sc)
public final StaticContext getStaticContext()
public boolean containsReferences() throws org.xml.sax.SAXException
public abstract Value evaluate(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedpublic boolean evaluateAsBoolean(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedpublic double evaluateAsNumber(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedpublic java.lang.String evaluateAsString(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedpublic NodeSetValue evaluateAsNodeSet(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedorg.xml.sax.SAXException
- when the expression is not a nodeset expression.public NodeEnumeration enumerate(Context context) throws org.xml.sax.SAXException
context
- The context in which the expression is to be evaluatedorg.xml.sax.SAXException
- when the expression is not a nodeset expression.public int getDataType()
public boolean isNumeric()
public final boolean isRelative() throws org.xml.sax.SAXException
public boolean usesCurrent() throws org.xml.sax.SAXException
public abstract int getDependencies()
public abstract Expression reduce(int dependencies, Context context) throws org.xml.sax.SAXException
dependencies
- The dependencies to be removed, e.g. Context.VARIABLEScontext
- The context to be used for the partial evaluation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |