public class SortKeyDefinition extends PseudoExpression
Note that most attributes defining the sort key can be attribute value templates, and can therefore vary from one invocation to another. We hold them as expressions.
Modifier and Type | Field and Description |
---|---|
protected boolean |
backwardsCompatible |
protected java.lang.String |
baseURI |
protected Operand |
caseOrder |
protected StringCollator |
collation |
protected Operand |
collationName |
protected Operand |
dataTypeExpression |
protected boolean |
emptyLeast |
protected Operand |
language |
protected Operand |
order |
protected boolean |
setContextForSortKey |
protected Operand |
sortKey |
protected Operand |
stable |
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 |
---|
SortKeyDefinition() |
Modifier and Type | Method and Description |
---|---|
int |
computeHashCode()
Get a hashcode to reflect the equals() method
|
SortKeyDefinition |
copy(RebindingMap rm)
Copy this SortKeyDefinition
|
boolean |
equals(java.lang.Object other)
Compare two SortKeyDefinition values for equality.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
SortKeyDefinition |
fix(XPathContext context) |
java.lang.String |
getBaseURI()
Get the static base URI of the expression.
|
Expression |
getCaseOrder()
Get the expression that defines the case order of the sort keys.
|
StringCollator |
getCollation()
Get the collation to be used
|
Expression |
getCollationNameExpression()
Get the selected collation name
(specifically, an expression which when evaluated returns the collation URI).
|
Expression |
getDataTypeExpression()
Get the expression that defines the data type of the sort keys
|
boolean |
getEmptyLeast()
Ask whether empty sequence comes before other values or after them
|
AtomicComparer |
getFinalComparator()
Get the comparator which is used to compare two values according to this sort key.
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
Expression |
getLanguage()
Get the expression that defines the language of the sort keys
|
Expression |
getOrder()
Get the expression that defines the order as ascending or descending
|
Expression |
getSortKey()
Get the expression used as the sort key
|
Operand |
getSortKeyOperand()
Get the sort key operand
|
Expression |
getStable()
Ask whether this sort key definition is stable
|
boolean |
isBackwardsCompatible()
Ask whether this sort key is evaluated in XSLT 1.0 backwards compatibility mode
|
boolean |
isFixed()
Ask whether the sort key definition is fixed, that is, whether all the information needed
to create a Comparator is known statically
|
boolean |
isLiftable(boolean forStreaming)
Ask whether the expression can be lifted out of a loop, assuming it has no dependencies
on the controlling variable/focus of the loop
|
boolean |
isSetContextForSortKey()
Ask whether the sortkey is to be evaluated with the item-being-sorted
as the context item
|
AtomicComparer |
makeComparator(XPathContext context)
Allocate an AtomicComparer to perform the comparisons described by this sort key component.
|
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.
|
void |
setBackwardsCompatible(boolean compatible)
Set whether this sort key is evaluated in XSLT 1.0 backwards compatibility mode
|
void |
setBaseURI(java.lang.String baseURI)
Set the base URI of the expression.
|
void |
setCaseOrder(Expression exp)
Set the case order.
|
void |
setCollation(StringCollator collation)
Set the collation to be used
|
void |
setCollationNameExpression(Expression collationNameExpr)
Set the collation name (specifically, an expression which when evaluated returns the collation URI).
|
void |
setDataTypeExpression(Expression exp)
Set the data type.
|
void |
setEmptyLeast(boolean emptyLeast)
Set whether empty sequence comes before other values or after them
|
void |
setFinalComparator(AtomicComparer comp)
Set the comparator which is used to compare two values according to this sort key.
|
void |
setLanguage(Expression exp)
Set the language.
|
void |
setOrder(Expression exp)
Set the order.
|
void |
setSortKey(Expression exp,
boolean setContext)
Set the expression used as the sort key
|
void |
setStable(Expression stableExpr)
Set whether this sort key definition is stable
|
SortKeyDefinition |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Type-check this sort key definition (all properties other than the sort key
select expression, when it has a different dynamic context)
|
computeCardinality, effectiveBooleanValue, evaluateAsString, evaluateItem, getItemType, iterate, process
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExpressionName, 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, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimize, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers
protected Operand sortKey
protected Operand order
protected Operand dataTypeExpression
protected Operand caseOrder
protected Operand language
protected Operand collationName
protected Operand stable
protected StringCollator collation
protected java.lang.String baseURI
protected boolean emptyLeast
protected boolean backwardsCompatible
protected boolean setContextForSortKey
public boolean isLiftable(boolean forStreaming)
isLiftable
in class Expression
forStreaming
- true if we are optimizing for streamed evaluationpublic void setSortKey(Expression exp, boolean setContext)
exp
- the sort key select expressionsetContext
- set to true if the sort key is to be evaluated with the
item-being-sorted as the context item (as in XSLT); false if the context item
is not to be set (as in XQuery)public Expression getSortKey()
public Operand getSortKeyOperand()
public boolean isSetContextForSortKey()
public void setOrder(Expression exp)
exp
- the expression that determines the order (always a literal in XQuery, but
can be defined by an AVT in XSLT)public Expression getOrder()
public void setDataTypeExpression(Expression exp)
exp
- the expression that defines the data type, as used in XSLT 1.0public Expression getDataTypeExpression()
public void setCaseOrder(Expression exp)
exp
- the expression that defines the case orderpublic Expression getCaseOrder()
public void setLanguage(Expression exp)
exp
- the expression that determines the languagepublic Expression getLanguage()
public void setCollationNameExpression(Expression collationNameExpr)
collationNameExpr
- the expression that determines the collation namepublic Expression getCollationNameExpression()
public void setCollation(StringCollator collation)
collation
- A StringCollator, which encapsulates both the collation URI and the collating functionpublic StringCollator getCollation()
public void setBaseURI(java.lang.String baseURI)
baseURI
- the static base URI of the expressionpublic java.lang.String getBaseURI()
public void setStable(Expression stableExpr)
stableExpr
- the expression that determines whether the sort key definition is stable
(it evaluates to the string "yes" or "no".public Expression getStable()
public void setBackwardsCompatible(boolean compatible)
compatible
- true if backwards compatibility mode is selectedpublic boolean isBackwardsCompatible()
public void setEmptyLeast(boolean emptyLeast)
emptyLeast
- true if () is considered lower than any other valuepublic boolean getEmptyLeast()
public boolean isFixed()
public SortKeyDefinition copy(RebindingMap rm)
copy
in class Expression
rm
- a mutable list of (old binding, new binding) pairs
that is used to update the bindings held in any
local variable references that are copied.public SortKeyDefinition typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
typeCheck
in class Expression
visitor
- the expression visitorcontextItemType
- the type of the context itemXPathException
- if any failure occurspublic java.lang.Iterable<Operand> operands()
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.
operands
in class Expression
public int getImplementationMethod()
getImplementationMethod
in class PseudoExpression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public AtomicComparer makeComparator(XPathContext context) throws XPathException
context
- the dynamic evaluation contextXPathException
- for example if the collation URI is invalid or unknownpublic void setFinalComparator(AtomicComparer comp)
This method is called at compile time if all these factors are known at compile time. It must not be called at run-time, except to reconstitute a finalComparator that has been lost by virtue of serialization .
comp
- the Atomic Comparer to be usedpublic AtomicComparer getFinalComparator()
makeComparator(net.sf.saxon.expr.XPathContext)
method.public SortKeyDefinition fix(XPathContext context) throws XPathException
XPathException
public boolean equals(java.lang.Object other)
equals
in class Expression
other
- SortKeyDefinitionpublic int computeHashCode()
computeHashCode
in class Expression
public void export(ExpressionPresenter out) throws XPathException
Expression
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.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.