public class MergeInstr extends Instruction
Modifier and Type | Class and Description |
---|---|
static class |
MergeInstr.MergeKeyMappingFunction |
static class |
MergeInstr.MergeSource
Inner class representing one merge source
|
Modifier and Type | Field and Description |
---|---|
protected AtomicComparer[] |
comparators |
protected MergeInstr.MergeSource[] |
mergeSources |
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
MergeInstr() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowExtractingCommonSubexpressions()
Ask whether common subexpressions found in the operands of this expression can
be extracted and evaluated outside the expression itself.
|
void |
checkPermittedContents(SchemaType parentType,
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.
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
void |
fixupGroupReferences() |
Expression |
getAction() |
ItemOrderComparer |
getComparer(SortKeyDefinitionList sKeys,
AtomicComparer[] comps) |
Expression |
getGroupingKey()
Get the grouping key expression expression (the group-by or group-adjacent expression, or a
PatternSponsor containing the group-starting-with or group-ending-with 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
|
MergeInstr.MergeSource[] |
getMergeSources() |
java.lang.String |
getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expression
|
MergeInstr |
init(MergeInstr.MergeSource[] mSources,
Expression action)
Initialise the merge instruction
|
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
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.
|
TailCall |
processLeavingTail(XPathContext context)
ProcessLeavingTail: called to do the real work of this instruction.
|
void |
setAction(Expression action) |
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform type checking of an expression and its subexpressions.
|
alwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getConstructType, getExpressionName, getImplementationMethod, getInstructionName, getNetCost, getSourceLocator, isInstruction, isXSLT, process, someOperandCreatesNewNodes
addToPathMap, adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, computeDependencies, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isLiftable, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers, verifyParentPointers
protected MergeInstr.MergeSource[] mergeSources
protected AtomicComparer[] comparators
public MergeInstr init(MergeInstr.MergeSource[] mSources, Expression action)
mSources
- the set of merge source definitionsaction
- the action to be performed on each group of items with identical merge keyspublic MergeInstr.MergeSource[] getMergeSources()
public void setAction(Expression action)
public Expression getAction()
public int getInstructionNameCode()
getInstructionNameCode
in class Instruction
public void checkPermittedContents(SchemaType parentType, boolean whole) throws XPathException
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 typewhole
- 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 typepublic boolean allowExtractingCommonSubexpressions()
allowExtractingCommonSubexpressions
in class Expression
public ItemType getItemType()
getItemType
in class Instruction
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Expression
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 may not be accurately known if they have not been explicitly declared.
typeCheck
in class Expression
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException
- if an error is discovered during this phase
(typically a type error)public void fixupGroupReferences() throws XPathException
XPathException
public final boolean mayCreateNewNodes()
mayCreateNewNodes
in class Instruction
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Expression
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.
optimize
in class Expression
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 to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public SequenceIterator iterate(XPathContext context) throws XPathException
Instruction
iterate
in class Instruction
context
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic java.lang.Iterable<Operand> operands()
operands
in class Instruction
public Expression getGroupingKey()
public ItemOrderComparer getComparer(SortKeyDefinitionList sKeys, AtomicComparer[] comps)
public Expression copy(RebindingMap rebindings)
copy
in class Expression
rebindings
- public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class Expression
out
- the expression presenter used to display the structureXPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.public TailCall processLeavingTail(XPathContext context) throws XPathException
Instruction
processLeavingTail
in interface TailCallReturner
processLeavingTail
in class Instruction
context
- The dynamic context of the transformation, giving access to the current node,
the current variables, etc.XPathException
- if a dynamic error occurs during the evaluation
of the instructionpublic java.lang.String getStreamerName()
getStreamerName
in class Expression
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.