|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.saxon.expr.ComputedExpression | +--net.sf.saxon.instruct.Instruction
Abstract superclass for all instructions in the compiled stylesheet.
This represents a compiled instruction, and as such, the minimum information is
retained from the original stylesheet.
Note: this class implements SourceLocator: that is, it can identify where in the stylesheet
the source instruction was located.
Field Summary |
Fields inherited from class net.sf.saxon.expr.ComputedExpression |
locationId, staticProperties |
Fields inherited from interface net.sf.saxon.expr.Expression |
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
Constructor Summary | |
Instruction()
Constructor |
Method Summary | |
abstract Expression |
analyze(StaticContext env,
ItemType contextItemType)
Perform static analysis of an expression and its subexpressions. |
static void |
appendItem(Item it,
SequenceReceiver out,
int locationId)
Static method to append an item that results from evaluating an expression to the current result receiver. |
protected static ParameterSet |
assembleParams(XPathContext context,
WithParam[] actualParams)
Assemble a ParameterSet. |
protected static ParameterSet |
assembleTunnelParams(XPathContext context,
WithParam[] actualParams)
Assemble a ParameterSet. |
int |
computeCardinality()
Get the cardinality of the sequence returned by evaluating this instruction |
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type). |
protected static XPathException |
dynamicError(javax.xml.transform.SourceLocator loc,
XPathException error,
XPathContext context)
Construct an exception with diagnostic information. |
protected XPathException |
dynamicError(java.lang.String message,
Controller controller)
Raise 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 |
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 |
getInstructionNameCode()
Get the namecode of the instruction for use in diagnostics |
ItemType |
getItemType()
Get the item type of the items returned by evaluating this instruction |
javax.xml.transform.SourceLocator |
getSourceLocator()
Get a SourceLocator identifying the location of this instruction |
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. |
void |
process(XPathContext context)
Process the instruction, without returning any tail calls |
abstract TailCall |
processLeavingTail(XPathContext context)
ProcessLeavingTail: called to do the real work of this instruction. |
Expression |
promote(PromotionOffer offer)
Offer promotion for this subexpression. |
protected void |
promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites. |
abstract Expression |
simplify(StaticContext env)
Simplify an expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.xml.transform.SourceLocator |
getColumnNumber, getLineNumber, getPublicId, getSystemId |
Methods inherited from interface net.sf.saxon.expr.Expression |
display |
Constructor Detail |
public Instruction()
Method Detail |
public int getImplementationMethod()
getImplementationMethod
in interface Expression
getImplementationMethod
in class ComputedExpression
public int getInstructionNameCode()
public ItemType getItemType()
getItemType
in interface Expression
public int computeCardinality()
computeCardinality
in class ComputedExpression
public abstract TailCall processLeavingTail(XPathContext context) throws XPathException
context
- The dynamic context of the transformation, giving access to the current node,
the current variables, etc.
XPathException
public void process(XPathContext context) throws XPathException
process
in interface Expression
process
in class ComputedExpression
context
- The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
public javax.xml.transform.SourceLocator getSourceLocator()
protected static XPathException dynamicError(javax.xml.transform.SourceLocator loc, XPathException error, XPathContext context)
error
- The exception containing information about the errorcontext
- The controller of the transformation
protected XPathException dynamicError(java.lang.String message, Controller controller)
message
- An English text error messagecontroller
- The controller of the transformation
protected static ParameterSet assembleParams(XPathContext context, WithParam[] actualParams) throws XPathException
XPathException
protected static ParameterSet assembleTunnelParams(XPathContext context, WithParam[] actualParams) throws XPathException
XPathException
public abstract Expression simplify(StaticContext env) throws XPathException
simplify
in interface Expression
simplify
in class ComputedExpression
XPathException
- if an error is discovered during expression
rewritingpublic abstract Expression analyze(StaticContext env, ItemType contextItemType) throws XPathException
This 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 will only be accurately known if they have been explicitly declared.
analyze
in interface Expression
env
- the static context of the expressioncontextItemType
- 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 int computeSpecialProperties()
computeSpecialProperties
in class ComputedExpression
protected void promoteInst(PromotionOffer offer) throws XPathException
offer
- The type of rewrite being offered
XPathException
public Expression promote(PromotionOffer offer) throws XPathException
promote
in interface Expression
promote
in class ComputedExpression
offer
- 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 Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface Expression
evaluateItem
in class ComputedExpression
context
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expressionpublic SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in interface Expression
iterate
in class ComputedExpression
context
- supplies the context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expressionpublic final java.lang.String evaluateAsString(XPathContext context) throws XPathException
evaluateAsString
in interface Expression
evaluateAsString
in class ComputedExpression
context
- 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 boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in interface Expression
effectiveBooleanValue
in class ComputedExpression
context
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expressionpublic InstructionInfo getInstructionInfo()
ComputedExpression
getInstructionInfo
in interface InstructionInfoProvider
getInstructionInfo
in class ComputedExpression
public static void appendItem(Item it, SequenceReceiver out, int locationId) throws XPathException
it
- the item: possibly a FunctionCallPackageout
- the Receiver
XPathException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |