|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.sf.saxon.expr.ComputedExpression
This class is an abstract superclass for different kinds of expression. This includes XSLT instructions, which are treated just like XPath expressions. Every expression is either a constant Value, or a ComputedExpression.
There are three principal methods for evaluating an expression: iterate(), which an iterator over the result of the expression as a sequence; evaluateItem(), which returns an object that is an instance of net.sf.saxon.om.Item; and process(), which pushes the results of the expression to a Receiver. All three methods take an XPathContext object to supply the evaluation context; for an expression that is a Value, this argument is ignored and may be null. This root class provides an implementation of iterate() in terms of evaluateItem() that works only for singleton expressions, and an implementation of evaluateItem() in terms of iterate() that works only for non-singleton expressions. Subclasses of expression must therefore provide either iterate() or evaluateItem() or process(): they do not have to provide all three.
Note that the methods that take an XPathContext argument are run-time methods. The methods without such an argument are compile-time methods. Run-time methods must not modify the state of the Expression object.
| Field Summary | |
protected int |
locationId
|
protected int |
staticProperties
|
| Fields inherited from interface net.sf.saxon.expr.Expression |
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
| Constructor Summary | |
ComputedExpression()
|
|
| Method Summary | |
protected void |
adoptChildExpression(Expression child)
|
protected abstract int |
computeCardinality()
|
int |
computeDependencies()
Compute the dependencies of an expression, as the union of the dependencies of its subexpressions. |
protected int |
computeSpecialProperties()
|
void |
computeStaticProperties()
Compute the static properties. |
protected void |
dynamicError(java.lang.String message,
java.lang.String code,
XPathContext context)
Method used in subclasses to signal a dynamic error |
protected void |
dynamicError(java.lang.String message,
XPathContext context)
Method used in subclasses to signal a dynamic error |
boolean |
effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression. |
java.lang.String |
evaluateAsString(XPathContext context)
Evaluate an expression as a String. |
Item |
evaluateItem(XPathContext context)
Evaluate an expression as a single item. |
int |
getCardinality()
Determine the static cardinality of the expression. |
int |
getColumnNumber()
Get the column number of the expression |
protected int |
getConstructType()
Get the type of this expression for use in tracing and diagnostics |
int |
getDependencies()
Determine which aspects of the context the expression depends on. |
Executable |
getExecutable()
Get the executable containing this expression |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). |
InstructionInfo |
getInstructionInfo()
Get InstructionInfo for this expression |
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. |
int |
getLineNumber()
Get the line number of the expression |
int |
getLocationId()
Get the location ID of the expression |
Container |
getParentExpression()
Get the expression that immediately contains this expression. |
java.lang.String |
getPublicId()
Get the publicId of the module containing the expression (to satisfy the SourceLocator interface) |
int |
getSpecialProperties()
Get the static properties of this expression (other than its type). |
java.lang.String |
getSystemId()
Get the systemId of the module containing the expression |
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. |
java.util.Iterator |
iterateSubExpressions()
Get the immediate sub-expressions of this expression. |
boolean |
markTailFunctionCalls()
Mark tail-recursive calls on stylesheet functions. |
void |
process(XPathContext context)
Process the instruction, without returning any tail calls |
Expression |
promote(PromotionOffer offer)
Offer promotion for this subexpression. |
void |
resetStaticProperties()
Reset the static properties. |
void |
setLocationId(int id)
Set the location ID on an expression. |
void |
setParentExpression(Container parent)
|
Expression |
simplify(StaticContext env)
Simplify an expression. |
protected void |
typeError(java.lang.String message,
XPathContext context)
Method used in subclasses to signal a runtime type error |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.saxon.expr.Expression |
analyze, display, getItemType |
| Field Detail |
protected int staticProperties
protected int locationId
| Constructor Detail |
public ComputedExpression()
| Method Detail |
public Container getParentExpression()
getParentExpression in interface Expressionpublic void setParentExpression(Container parent)
protected void adoptChildExpression(Expression child)
public int getImplementationMethod()
getImplementationMethod in interface Expressionpublic void setLocationId(int id)
public final int getLocationId()
public int getLineNumber()
getLineNumber in interface javax.xml.transform.SourceLocatorpublic int getColumnNumber()
getColumnNumber in interface javax.xml.transform.SourceLocatorpublic java.lang.String getSystemId()
getSystemId in interface javax.xml.transform.SourceLocatorpublic final java.lang.String getPublicId()
getPublicId in interface javax.xml.transform.SourceLocatorpublic Executable getExecutable()
getExecutable in interface Container
public Expression simplify(StaticContext env)
throws XPathException
simplify in interface ExpressionXPathException - if an error is discovered during expression
rewriting
public Expression promote(PromotionOffer offer)
throws XPathException
promote in interface Expressionoffer - details of the offer, for example the offer to move
expressions that don't depend on the context to an outer level in
the containing expression
XPathException - if any error is detectedpublic final int getSpecialProperties()
getSpecialProperties in interface Expressionpublic final void computeStaticProperties()
public final void resetStaticProperties()
protected abstract int computeCardinality()
protected int computeSpecialProperties()
public int getCardinality()
getCardinality in interface Expressionpublic int getDependencies()
getDependencies in interface Expressionpublic int computeDependencies()
public int getIntrinsicDependencies()
public java.util.Iterator iterateSubExpressions()
iterateSubExpressions in interface Expressionpublic boolean markTailFunctionCalls()
public Item evaluateItem(XPathContext context)
throws XPathException
evaluateItem in interface Expressioncontext - The context in which the expression is to be evaluated
XPathException - if any dynamic error occurs evaluating the
expression
public java.lang.String evaluateAsString(XPathContext context)
throws XPathException
evaluateAsString in interface Expressioncontext - The context in which the expression is to be evaluated
XPathException - if any dynamic error occurs evaluating the
expression
java.lang.ClassCastException - if the result type of the
expression is not xs:string?
public SequenceIterator iterate(XPathContext context)
throws XPathException
iterate in interface Expressioncontext - supplies the context for evaluation
XPathException - if any dynamic error occurs evaluating the
expression
public boolean effectiveBooleanValue(XPathContext context)
throws XPathException
effectiveBooleanValue in interface Expressioncontext - The context in which the expression is to be evaluated
XPathException - if any dynamic error occurs evaluating the
expression
public void process(XPathContext context)
throws XPathException
process in interface Expressioncontext - The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
protected void dynamicError(java.lang.String message,
XPathContext context)
throws DynamicError
DynamicError
protected void dynamicError(java.lang.String message,
java.lang.String code,
XPathContext context)
throws DynamicError
DynamicError
protected void typeError(java.lang.String message,
XPathContext context)
throws DynamicError
DynamicErrorpublic InstructionInfo getInstructionInfo()
getInstructionInfo in interface InstructionInfoProviderprotected int getConstructType()
Location
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||