public final class EvaluateInstr extends Expression
The implementation maintains a cache of compiled expressions, provided that the namespace context is not constructed dynamically. The cache is an LRU cache with a fixed size of 100 entries. This is to avoid uncontrolled use of memory when the XPath expressions are completely dynamic and each one is unique.
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
EvaluateInstr(Expression xpath,
SequenceType requiredType,
Expression contextItemExpr,
Expression baseUriExpr,
Expression namespaceContextExpr,
Expression schemaAwareExpr)
Create an xsl:evaluate instruction
|
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
protected int |
computeCardinality()
Compute the static cardinality of this expression
|
int |
computeDependencies()
Compute the dependencies of an expression, as the union of the
dependencies of its subexpressions.
|
Expression |
copy()
Copy an expression.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
WithParam[] |
getActualParams() |
Expression |
getBaseUriExpr() |
Expression |
getContextItemExpr() |
Expression |
getDynamicParams() |
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the EvaluateIntr expression
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Determine the data type of the items returned by this expression
|
Expression |
getNamespaceContextExpr() |
Expression |
getSchemaAwareExpr() |
Expression |
getXpath() |
void |
importSchemaNamespace(String ns)
Add an imported schema namespace
|
boolean |
isActualParam(StructuredQName name) |
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
protected void |
promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.
|
void |
setActualParameters(WithParam[] params) |
void |
setActualParams(WithParam[] actualParams) |
void |
setBaseUriExpr(Expression baseUriExpr) |
void |
setContextItemExpr(Expression contextItemExpr) |
void |
setDynamicParams(Expression params) |
void |
setNamespaceContextExpr(Expression namespaceContextExpr) |
void |
setSchemaAwareExpr(Expression schemaAwareExpr) |
void |
setXpath(Expression xpath) |
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression
|
adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeSpecialProperties, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExpressionName, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getPosture, getPostureAndSweepIfKnown, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStreamability, getStreamingAdjunct, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, optimizeForType, process, promote, promoteChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setFiltered, setFlattened, setLocation, setParentExpression, setPostureAndSweep, setRetainedStaticContext, setRetainedStaticContextLocally, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toStreamingPattern, toString, typeCheckChildren, typeError, unordered
public EvaluateInstr(Expression xpath, SequenceType requiredType, Expression contextItemExpr, Expression baseUriExpr, Expression namespaceContextExpr, Expression schemaAwareExpr)
xpath
- The expression that returns the string that is to be parsed as an XPath expressionrequiredType
- the required type of the result of evaluating the XPath expressioncontextItemExpr
- The expression that delivers the context itembaseUriExpr
- the expression whose value is used as the static base URI of the XPath expressionnamespaceContextExpr
- the expression that delivers a node whose namespace context provides the
static namespace context for the XPath expressionschemaAwareExpr
- an expression whose value is true if the XPath expression is to be treated as schema
aware, or false otherwisepublic void setActualParameters(WithParam[] params)
public void importSchemaNamespace(String ns)
ns
- the namespace to be imported ("" for the non-namespace)public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class Expression
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException
- if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Expression
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class Expression
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public final ItemType getItemType()
getItemType
in class Expression
protected int computeCardinality()
Expression
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.
addToPathMap
in class Expression
pathMap
- the PathMap to which the expression should be addedpathMapNodeSet
- the set of nodes in the path map that are affectedpublic int computeDependencies()
computeDependencies
in class Expression
protected void promoteInst(PromotionOffer offer) throws XPathException
offer
- The type of rewrite being offeredXPathException
- if an error is detectedpublic Iterable<Operand> operands()
Expression
If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
operands
in class Expression
public int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public Expression copy()
copy
in class Expression
public SequenceIterator iterate(XPathContext context) throws XPathException
Expression
iterate
in class Expression
context
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class Expression
public void export(ExpressionPresenter out)
export
in class Expression
out
- the expression presenter used to display the structurepublic Expression getXpath()
public void setXpath(Expression xpath)
public Expression getContextItemExpr()
public void setContextItemExpr(Expression contextItemExpr)
public Expression getBaseUriExpr()
public void setBaseUriExpr(Expression baseUriExpr)
public Expression getNamespaceContextExpr()
public void setNamespaceContextExpr(Expression namespaceContextExpr)
public Expression getSchemaAwareExpr()
public void setSchemaAwareExpr(Expression schemaAwareExpr)
public WithParam[] getActualParams()
public void setActualParams(WithParam[] actualParams)
public boolean isActualParam(StructuredQName name)
public void setDynamicParams(Expression params)
public Expression getDynamicParams()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.