public class ConditionalSorter extends 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 and Description |
|---|
ConditionalSorter(Expression condition,
DocumentSorter sorter)
Create a conditional document sorter
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
computeCardinality()
Compute the static cardinality of this expression
|
protected int |
computeSpecialProperties()
Compute the special properties of this expression.
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
int |
getCardinality()
Determine the static cardinality of the expression.
|
Expression |
getCondition()
Get the condition under which the nodes need to be sorted
|
DocumentSorter |
getDocumentSorter()
Get the document sorter, which sorts the nodes if the condition is true
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Determine the data type of the expression, if possible.
|
SequenceIterator<?> |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
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 |
setCondition(Expression condition) |
void |
setDocumentSorter(DocumentSorter documentSorter) |
Expression |
simplify()
Simplify an expression.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform type checking of an expression and its subexpressions.
|
Expression |
unordered(boolean retainAllNodes,
boolean forStreaming)
Replace this expression by a simpler expression that delivers the results without regard
to order.
|
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, verifyParentPointerspublic ConditionalSorter(Expression condition, DocumentSorter sorter)
condition - the conditional expressionsorter - the sorting expressionpublic java.lang.Iterable<Operand> operands()
ExpressionIf 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.
operands in class Expressionpublic void setCondition(Expression condition)
public void setDocumentSorter(DocumentSorter documentSorter)
public Expression getCondition()
public DocumentSorter getDocumentSorter()
public Expression simplify() throws XPathException
Expressionsimplify in class ExpressionXPathException - if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck in class Expressionvisitor - 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 int getCardinality()
getCardinality in class Expressionprotected int computeSpecialProperties()
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 Expressionpublic int getImplementationMethod()
getImplementationMethod in class ExpressionExpression.ITERATE_METHOD or Expression.EVALUATE_METHOD or
Expression.PROCESS_METHODpublic Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) 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 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_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public Expression unordered(boolean retainAllNodes, boolean forStreaming) throws XPathException
Expressionunordered in class ExpressionretainAllNodes - set to true if the result must contain exactly the same nodes as the
original; set to false if the result can eliminate (or introduce) duplicates.forStreaming - set to true if the result is to be optimized for streamingXPathException - if the rewrite failsprotected int computeCardinality()
computeCardinality in class ExpressionStaticProperty.ALLOWS_ZERO_OR_ONE,
StaticProperty.EXACTLY_ONE, StaticProperty.ALLOWS_ONE_OR_MORE,
StaticProperty.ALLOWS_ZERO_OR_MOREpublic Expression copy(RebindingMap rebindings)
copy in class Expressionrebindings - public void export(ExpressionPresenter out) throws XPathException
export in interface ExportAgentexport in class Expressionout - 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 ItemType getItemType()
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType in class Expressionpublic SequenceIterator<?> iterate(XPathContext context) throws XPathException
iterate in class Expressioncontext - supplies the context for evaluationXPathException - if any dynamic error occurs evaluating the
expressionpublic java.lang.String getExpressionName()
getExpressionName in class ExpressionCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.