Package net.sf.saxon.expr.instruct
Class MessageInstr
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.instruct.Instruction
-
- net.sf.saxon.expr.instruct.MessageInstr
-
- All Implemented Interfaces:
ExportAgent
,Locatable
,IdentityComparable
,Traceable
public class MessageInstr extends Instruction
An xsl:message or xsl:assert element in the stylesheet.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description MessageInstr(Expression select, Expression terminate, Expression errorCode)
Create an xsl:message instruction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
copy(RebindingMap rebindings)
Copy an expression.void
export(ExpressionPresenter out)
Diagnostic print of expression structure.int
getCardinality()
Get the static cardinality.Elaborator
getElaborator()
Make an elaborator for this expressionExpression
getErrorCode()
int
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposesItemType
getItemType()
Get the item type.Expression
getSelect()
Expression
getTerminate()
boolean
mayCreateNewNodes()
Determine whether this instruction creates new nodes.java.lang.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 contextInfo)
Perform optimisation of an expression and its subexpressions.void
setErrorCode(Expression errorCode)
void
setIsAssert(boolean isAssert)
Say whether this instruction is implementing xsl:message or xsl:assertvoid
setSelect(Expression select)
void
setTerminate(Expression terminate)
-
Methods inherited from class net.sf.saxon.expr.instruct.Instruction
alwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getExpressionName, getImplementationMethod, getNetCost, getSourceLocator, isInstruction, isXSLT, iterate, process, someOperandCreatesNewNodes
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, equals, explain, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, toShortString, toString, typeCheck, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocation
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Constructor Detail
-
MessageInstr
public MessageInstr(Expression select, Expression terminate, Expression errorCode)
Create an xsl:message instruction- Parameters:
select
- the expression that constructs the message (composite of the select attribute and the contained sequence constructor)terminate
- expression that calculates terminate = yes or no.errorCode
- expression used to compute the error code
-
-
Method Detail
-
getSelect
public Expression getSelect()
-
setSelect
public void setSelect(Expression select)
-
getTerminate
public Expression getTerminate()
-
setTerminate
public void setTerminate(Expression terminate)
-
getErrorCode
public Expression getErrorCode()
-
setErrorCode
public void setErrorCode(Expression errorCode)
-
operands
public java.lang.Iterable<Operand> operands()
Description copied from class:Expression
Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent 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.
- Specified by:
operands
in classInstruction
- Returns:
- an iterator containing the sub-expressions of this expression
-
setIsAssert
public void setIsAssert(boolean isAssert)
Say whether this instruction is implementing xsl:message or xsl:assert- Parameters:
isAssert
- true if this is xsl:assert; false if it is xsl:message
-
copy
public Expression copy(RebindingMap rebindings)
Copy an expression. This makes a deep copy.- Specified by:
copy
in classExpression
- Parameters:
rebindings
- the rebinding map- Returns:
- the copy of the original expression
-
getInstructionNameCode
public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes- Overrides:
getInstructionNameCode
in classInstruction
- Returns:
- a code identifying the instruction: typically but not always the fingerprint of a name in the XSLT namespace
-
getItemType
public ItemType getItemType()
Get the item type. To avoid spurious compile-time type errors, we falsely declare that the instruction can return anything- Overrides:
getItemType
in classInstruction
- Returns:
- AnyItemType
-
getCardinality
public int getCardinality()
Get the static cardinality. To avoid spurious compile-time type errors, we falsely declare that the instruction returns zero or one items - this is always acceptable- Overrides:
getCardinality
in classExpression
- Returns:
- zero or one
-
mayCreateNewNodes
public final boolean mayCreateNewNodes()
Determine whether this instruction creates new nodes. This implementation returns true.- Overrides:
mayCreateNewNodes
in classInstruction
- Returns:
- true if the instruction creates new nodes under some input conditions (or if it can't be proved that it doesn't)
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.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.
- Overrides:
optimize
in classExpression
- Parameters:
visitor
- an expression visitorcontextInfo
- 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 toType.ITEM_TYPE
- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
export
public void export(ExpressionPresenter out) throws XPathException
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
export
in interfaceExportAgent
- Specified by:
export
in classExpression
- Parameters:
out
- the expression presenter used to display the structure- Throws:
XPathException
- if the export fails, for example if an expression is found that won't work in the target environment.
-
getElaborator
public Elaborator getElaborator()
Description copied from class:Expression
Make an elaborator for this expression- Overrides:
getElaborator
in classExpression
- Returns:
- an appropriate
Elaborator
-
-