public class TraceExpression extends Instruction implements InstructionInfo
EFFECTIVE_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 |
|---|
TraceExpression(Expression child)
Create a trace expression that traces execution of a given child expression
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkForUpdatingSubexpressions()
Check to ensure that this expression does not contain any inappropriate updating subexpressions.
|
int |
computeDependencies()
Get the static properties of this expression (other than its type).
|
Expression |
copy()
Copy an expression.
|
boolean |
createsNewNodes()
Determine whether this instruction creates new nodes.
|
Item |
evaluateItem(XPathContext context)
Evaluate an expression as a single item.
|
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.
|
Expression |
getChildExpression() |
int |
getColumnNumber(long locationId)
Get the column number within the document, entity, or module containing a particular location
|
int |
getConstructType()
Get the construct type.
|
int |
getDependencies()
Determine which aspects of the context the expression depends on.
|
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the Trace expression
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
InstructionInfo |
getInstructionInfo()
Get the InstructionInfo details about the construct.
|
int |
getInstructionNameCode()
Get the namecode of the instruction for use in diagnostics
|
ItemType |
getItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction
|
int |
getLineNumber(long locationId)
Get the line number of the expression being
traced.
|
NamespaceResolver |
getNamespaceResolver()
Get the namespace resolver to supply the namespace context of the instruction
that is being traced
|
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<String> |
getProperties()
Get an iterator over all the properties available.
|
Object |
getProperty(String name)
Get a named property of the instruction/expression
|
String |
getSystemId(long locationId)
Get the system identifier (that is the base URI) of the static context of the expression being
traced.
|
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<Item> |
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.
|
Expression |
optimize(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
|
TailCall |
processLeavingTail(XPathContext context)
Execute this instruction, with the possibility of returning tail calls if there are any.
|
Expression |
promote(PromotionOffer offer,
Expression parent)
Offer promotion for this subexpression.
|
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
void |
setConstructType(int type)
Set the type of construct.
|
void |
setNamespaceResolver(NamespaceResolver resolver)
Set the namespace context for the instruction being traced.
|
void |
setObjectName(StructuredQName qName)
Set a name identifying the object of the expression, for example a function name, template name,
variable name, key name, element name, etc.
|
void |
setProperty(String name,
Object value)
Set a named property of the instruction/expression
|
Expression |
simplify(ExpressionVisitor visitor)
Simplify an expression.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
Perform type checking of an expression and its subexpressions.
|
assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, getExpressionName, getInstructionName, getIteratorFromProcessMethod, getSourceLocator, isXSLT, process, promoteInstaddToPathMap, adoptChildExpression, checkPermittedContents, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, explain, getColumnNumber, getContainer, getEvaluationMethod, getExecutable, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getStreamingAdjunct, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, iterateEvents, iterateSubExpressionInfo, markTailFunctionCalls, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, toString, typeErrorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLineNumber, getSystemIdgetColumnNumber, getPublicIdgetColumnNumber, getPublicIdpublic TraceExpression(Expression child)
child - the expression to be traced. This will be available to the TraceListener
as the value of the "expression" property of the InstructionInfo.public void setConstructType(int type)
Locationtype - an integer code for the type of construct being tracedpublic int getConstructType()
LocationgetConstructType in interface InstructionInfogetConstructType in class InstructionLocationpublic void setNamespaceResolver(NamespaceResolver resolver)
resolver - The namespace resolver, or null if none is neededpublic NamespaceResolver getNamespaceResolver()
public void setObjectName(StructuredQName qName)
qName - the name of the object, or null if not applicablepublic StructuredQName getObjectName()
getObjectName in interface InstructionInfogetObjectName in class Expressionpublic void setProperty(String name, Object value)
name - the name of the propertyvalue - the value of the propertypublic Object getProperty(String name)
getProperty in interface InstructionInfogetProperty in class Expressionname - the name of the propertypublic Iterator<String> getProperties()
getProperties in interface InstructionInfogetProperties in class Expressionpublic InstructionInfo getInstructionInfo()
public String getSystemId(long locationId)
LocationProvider interface.getSystemId in interface LocationProvidergetSystemId in class ExpressionlocationId - not usedpublic int getLineNumber(long locationId)
LocationProvider interface.getLineNumber in interface LocationProvidergetLineNumber in class ExpressionlocationId - not usedpublic int getColumnNumber(long locationId)
LocationProvidergetColumnNumber in interface LocationProvidergetColumnNumber in class ExpressionlocationId - identifier of the location in question (as passed down the Receiver pipeline)public Expression copy()
Expressioncopy in class Expressionpublic boolean isUpdatingExpression()
isUpdatingExpression in class Expressionpublic boolean isVacuousExpression()
isVacuousExpression in class Expressionpublic void checkForUpdatingSubexpressions()
throws XPathException
checkForUpdatingSubexpressions in class ExpressionXPathException - if the expression has a non-permitted updating subexpressionpublic Expression simplify(ExpressionVisitor visitor) throws XPathException
simplify in class Instructionvisitor - an expression visitorXPathException - if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
ExpressionThis checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.
If the implementation returns a value other than "this", then it is required to ensure that the location information in the returned expression have been set up correctly. It should not rely on the caller to do this, although for historical reasons many callers do so.
typeCheck in class Expressionvisitor - 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_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
ExpressionThis 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 Expressionvisitor - 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_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public int getImplementationMethod()
InstructiongetImplementationMethod in class InstructionExpression.ITERATE_METHOD or Expression.EVALUATE_METHOD or
Expression.PROCESS_METHODpublic Expression promote(PromotionOffer offer, Expression parent) throws XPathException
promote in class Instructionoffer - 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 expressionparent - the parent of the subexpressionXPathException - if any error is detectedpublic TailCall processLeavingTail(XPathContext context) throws XPathException
processLeavingTail in interface TailCallReturnerprocessLeavingTail in class Instructioncontext - the dynamic execution contextXPathExceptionpublic ItemType getItemType(TypeHierarchy th)
getItemType in class Instructionth - the type hierarchy cachepublic int getCardinality()
getCardinality in class Expressionpublic int getDependencies()
StaticProperty.DEPENDS_ON_CONTEXT_ITEM and
StaticProperty.DEPENDS_ON_CURRENT_ITEM. The default implementation combines the intrinsic
dependencies of this expression with the dependencies of the subexpressions,
computed recursively. This is overridden for expressions such as FilterExpression
where a subexpression's dependencies are not necessarily inherited by the parent
expression.getDependencies in class Expressionpublic final boolean createsNewNodes()
createsNewNodes in class Instructionpublic int computeDependencies()
computeDependencies in class Expressionpublic Item evaluateItem(XPathContext context) throws XPathException
evaluateItem in class Instructioncontext - The context in which the expression is to be evaluatedXPathException - if any dynamic error occurs evaluating the
expressionpublic SequenceIterator<Item> iterate(XPathContext context) throws XPathException
iterate in class Instructioncontext - supplies the context for evaluationXPathException - if any dynamic error occurs evaluating the
expressionpublic Iterator<Expression> iterateSubExpressions()
ExpressioniterateSubExpressions in class Expressionpublic boolean replaceSubExpression(Expression original, Expression replacement)
replaceSubExpression in class Expressionoriginal - the original subexpressionreplacement - the replacement subexpressionpublic Expression getChildExpression()
public int getInstructionNameCode()
InstructiongetInstructionNameCode in class Instructionpublic void explain(ExpressionPresenter out)
explain in class Expressionout - the expression presenter used to display the structurepublic void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException
evaluatePendingUpdates in class Expressioncontext - the XPath dynamic evaluation contextpul - the pending update list to which the results should be writtenXPathException - if evaluation failspublic ExpressionCompiler getExpressionCompiler()
getExpressionCompiler in class ExpressionCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.