|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression com.saxonica.bytecode.CompiledExpression
public class CompiledExpression
An expression that has been compiled to Java bytecode. The actual bytecode is contained
in a separate object of type GeneratedCode
, to which evaluation is delegated
Field Summary |
---|
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD |
Constructor Summary | |
---|---|
CompiledExpression(Expression original,
GeneratedCode byteCode)
|
Method Summary | |
---|---|
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, but there is no guarantee that the syntax will actually be true XPath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CompiledExpression(Expression original, GeneratedCode byteCode)
Method Detail |
---|
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 cache
public 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 written
XPathException
- if evaluation failspublic String toString()
Expression
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 content
XPathException
- 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 subexpression
public 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 property
public 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 added
public boolean isSubtreeExpression()
Expression
isSubtreeExpression
in class Expression
public SequenceIterator iterate(XPathContext context) throws XPathException
Expression
iterate
in class Expression
context
- supplies the context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expressionpublic Iterator<Expression> iterateSubExpressions()
Expression
iterateSubExpressions
in class Expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |