public class CompiledExpression extends Expression
GeneratedCode
, to which evaluation is delegatedEFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, WATCH_METHOD
Constructor and Description |
---|
CompiledExpression(Expression original,
GeneratedCode byteCode) |
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
void |
checkForUpdatingSubexpressions()
Check to ensure that this expression does not contain any inappropriate updating subexpressions.
|
void |
checkPermittedContents(SchemaType parentType,
StaticContext env,
boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable
in the content model of a given complex type.
|
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.
|
protected int |
computeSpecialProperties()
Compute the special properties of this expression.
|
Expression |
copy()
Copy an expression.
|
void |
evaluatePendingUpdates(XPathContext context,
PendingUpdateList pul)
Evaluate an updating expression, adding the results to a Pending Update List.
|
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure.
|
int |
getCardinality()
Determine the static cardinality of the expression.
|
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.
|
String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived
from the dependencies of its subexpressions.
|
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible.
|
StructuredQName |
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name,
variable name, key name, element name, etc.
|
Iterator |
getProperties()
Get an iterator over all the properties available.
|
Object |
getProperty(String name)
Get the value of a particular property of the instruction.
|
boolean |
isSubtreeExpression()
Determine whether the expression can be evaluated without reference to the part of the context
document outside the subtree rooted at the context node.
|
boolean |
isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification
|
boolean |
isVacuousExpression()
Determine whether this is a vacuous expression as defined in the XQuery update specification
|
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
Iterator<Expression> |
iterateSubExpressions()
Get the immediate sub-expressions of this expression.
|
void |
process(XPathContext context)
Process the instruction, without returning any tail calls
|
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
String |
toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form.
|
adoptChildExpression, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, getColumnNumber, getColumnNumber, getContainer, getEvaluationMethod, getExecutable, getExpressionCompiler, getIntegerBounds, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getStreamingAdjunct, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, iterateEvents, iterateSubExpressionInfo, markTailFunctionCalls, optimize, promote, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, typeCheck, typeError
public CompiledExpression(Expression original, GeneratedCode byteCode)
public String getExpressionName()
Expression
getExpressionName
in class Expression
public int getImplementationMethod()
Expression
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public int getCardinality()
Expression
getCardinality
in class Expression
public ItemType getItemType(TypeHierarchy th)
Expression
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType
in class Expression
th
- the type hierarchy cachepublic int getDependencies()
Expression
getDependencies
in class Expression
public void process(XPathContext context) throws XPathException
Expression
process
in class Expression
context
- The dynamic context, giving access to the current node,
the current variables, etc.XPathException
- if a dynamic error occurspublic void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException
Expression
evaluatePendingUpdates
in class Expression
context
- the XPath dynamic evaluation contextpul
- the pending update list to which the results should be writtenXPathException
- if evaluation failspublic String toString()
Expression
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form.
For subclasses of Expression that represent XPath expressions, the result should always be a string that parses as an XPath 3.0 expression. The expression produced should be equivalent to the original making certain assumptions about the static context. In general the expansion will make no assumptions about namespace bindings, except that (a) the prefix "xs" is used to refer to the XML Schema namespace, and (b) the default funcion namespace is assumed to be the "fn" namespace.
In the case of XSLT instructions and XQuery expressions, the toString() method gives an abstracted view of the syntax that is not designed in general to be parseable.
toString
in class Expression
public void explain(ExpressionPresenter out)
Expression
explain
in class Expression
out
- the expression presenter used to display the structurepublic void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException
Expression
checkPermittedContents
in class Expression
parentType
- the "given complex type": the method is checking that the nodes returned by this
expression are acceptable members of the content model of this typeenv
- the static contextwhole
- if true, we want to check that the value of this expression satisfies the content model
as a whole; if false we want to check that the value of the expression is acceptable as one part
of the contentXPathException
- if the value delivered by this expression cannot be part of the content model
of the given typeprotected 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
protected int computeSpecialProperties()
Expression
StaticProperty
. The "special" properties are properties
other than cardinality and dependencies, and most of them relate to properties of node sequences, for
example whether the nodes are in document order.computeSpecialProperties
in class Expression
public int computeDependencies()
Expression
computeDependencies
in class Expression
public int getIntrinsicDependencies()
Expression
getIntrinsicDependencies
in class Expression
public void checkForUpdatingSubexpressions() throws XPathException
Expression
checkForUpdatingSubexpressions
in class Expression
XPathException
- if the expression has a non-permitted updating subexpressionpublic boolean isUpdatingExpression()
Expression
isUpdatingExpression
in class Expression
public boolean isVacuousExpression()
Expression
isVacuousExpression
in class Expression
public Expression copy()
Expression
copy
in class Expression
public boolean replaceSubExpression(Expression original, Expression replacement)
Expression
replaceSubExpression
in class Expression
original
- the original subexpressionreplacement
- the replacement subexpressionpublic int getConstructType()
Expression
getConstructType
in interface InstructionInfo
getConstructType
in class Expression
Location
public StructuredQName getObjectName()
InstructionInfo
getObjectName
in interface InstructionInfo
getObjectName
in class Expression
public Object getProperty(String name)
InstructionInfo
getProperty
in interface InstructionInfo
getProperty
in class Expression
name
- The name of the required propertypublic Iterator getProperties()
Expression
getProperties
in interface InstructionInfo
getProperties
in class Expression
public int getHostLanguage()
Expression
getHostLanguage
in class Expression
Configuration.XSLT
or Configuration.XQUERY
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Expression
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 PathMapNodeSet to which the paths embodied in this expression should be addedpublic boolean isSubtreeExpression()
Expression
isSubtreeExpression
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 Iterator<Expression> iterateSubExpressions()
Expression
iterateSubExpressions
in class Expression
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.