Package net.sf.saxon.sort
Class SortKeyDefinition
- java.lang.Object
-
- net.sf.saxon.sort.SortKeyDefinition
-
- All Implemented Interfaces:
java.io.Serializable
public class SortKeyDefinition extends java.lang.Object implements java.io.SerializableA SortKeyDefinition defines one component of a sort key.
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. As soon as they are all known (which in general is only at run-time), the SortKeyDefinition is replaced by a FixedSortKeyDefinition in which all these values are fixed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbackwardsCompatibleprotected java.lang.StringbaseURIprotected ExpressioncaseOrderprotected java.util.Comparatorcollationprotected ExpressioncollationNameprotected java.util.Comparatorcomparerprotected ExpressiondataTypeExpressionprotected booleanemptyLeastprotected Expressionlanguageprotected Expressionorderprotected ContainerparentExpressionprotected ExpressionsortKeyprotected Expressionstable
-
Constructor Summary
Constructors Constructor Description SortKeyDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBaseURI()ExpressiongetCaseOrder()java.util.ComparatorgetCollation()ExpressiongetCollationName()java.util.ComparatorgetComparer()Get the comparer which is used to compare two values according to this sort key.ExpressiongetDataTypeExpression()booleangetEmptyLeast()ExpressiongetLanguage()ExpressiongetOrder()ContainergetParentExpression()ExpressiongetSortKey()Get the expression used as the sort keyExpressiongetStable()booleanisBackwardsCompatible()booleanisFixed()Determine whether the sort key definition is fixed, that is, whether all the information needed to create a Comparator is known staticallyjava.util.ComparatormakeComparator(XPathContext context)Allocate a Comparator to perform the comparisons described by this sort key componentvoidsetBackwardsCompatible(boolean compatible)voidsetBaseURI(java.lang.String baseURI)voidsetCaseOrder(Expression exp)Set the case order.voidsetCollation(java.util.Comparator collation)voidsetCollationName(Expression collationName)Set the collation.voidsetComparer(java.util.Comparator comp)Set the comparer which is used to compare two values according to this sort key.voidsetDataTypeExpression(Expression exp)Set the data type.voidsetEmptyLeast(boolean emptyLeast)Set whether empty sequence comes before other values or after themvoidsetLanguage(Expression exp)Set the language.voidsetOrder(Expression exp)Set the order.voidsetParentExpression(Container container)voidsetSortKey(Expression exp)Set the expression used as the sort keyvoidsetStable(Expression stable)SortKeyDefinitionsimplify(StaticContext env, Executable exec)
-
-
-
Field Detail
-
sortKey
protected Expression sortKey
-
order
protected Expression order
-
dataTypeExpression
protected Expression dataTypeExpression
-
caseOrder
protected Expression caseOrder
-
language
protected Expression language
-
collationName
protected Expression collationName
-
stable
protected Expression stable
-
collation
protected transient java.util.Comparator collation
-
baseURI
protected java.lang.String baseURI
-
emptyLeast
protected boolean emptyLeast
-
backwardsCompatible
protected boolean backwardsCompatible
-
parentExpression
protected Container parentExpression
-
comparer
protected transient java.util.Comparator comparer
-
-
Method Detail
-
setParentExpression
public void setParentExpression(Container container)
-
getParentExpression
public Container getParentExpression()
-
setSortKey
public void setSortKey(Expression exp)
Set the expression used as the sort key
-
getSortKey
public Expression getSortKey()
Get the expression used as the sort key
-
setOrder
public void setOrder(Expression exp)
Set the order. This is supplied as an expression which must evaluate to "ascending" or "descending". If the order is fixed, supply e.g. new StringValue("ascending"). Default is "ascending".
-
getOrder
public Expression getOrder()
-
setDataTypeExpression
public void setDataTypeExpression(Expression exp)
Set the data type. This is supplied as an expression which must evaluate to "text", "number", or a QName. If the data type is fixed, the valus should be supplied using setDataType() and not via this method.
-
getDataTypeExpression
public Expression getDataTypeExpression()
-
setCaseOrder
public void setCaseOrder(Expression exp)
Set the case order. This is supplied as an expression which must evaluate to "upper-first" or "lower-first" or "#default". If the order is fixed, supply e.g. new StringValue("lower-first"). Default is "#default".
-
getCaseOrder
public Expression getCaseOrder()
-
setLanguage
public void setLanguage(Expression exp)
Set the language. This is supplied as an expression which evaluates to the language name. If the order is fixed, supply e.g. new StringValue("de").
-
getLanguage
public Expression getLanguage()
-
setCollationName
public void setCollationName(Expression collationName)
Set the collation.
-
getCollationName
public Expression getCollationName()
-
setCollation
public void setCollation(java.util.Comparator collation)
-
getCollation
public java.util.Comparator getCollation()
-
setBaseURI
public void setBaseURI(java.lang.String baseURI)
-
getBaseURI
public java.lang.String getBaseURI()
-
setStable
public void setStable(Expression stable)
-
getStable
public Expression getStable()
-
setBackwardsCompatible
public void setBackwardsCompatible(boolean compatible)
-
isBackwardsCompatible
public boolean isBackwardsCompatible()
-
setEmptyLeast
public void setEmptyLeast(boolean emptyLeast)
Set whether empty sequence comes before other values or after them- Parameters:
emptyLeast- true if () is considered lower than any other value
-
getEmptyLeast
public boolean getEmptyLeast()
-
isFixed
public boolean isFixed()
Determine whether the sort key definition is fixed, that is, whether all the information needed to create a Comparator is known statically
-
simplify
public SortKeyDefinition simplify(StaticContext env, Executable exec) throws XPathException
- Throws:
XPathException
-
makeComparator
public java.util.Comparator makeComparator(XPathContext context) throws XPathException
Allocate a Comparator to perform the comparisons described by this sort key component- Throws:
XPathException
-
setComparer
public void setComparer(java.util.Comparator comp)
Set the comparer which is used to compare two values according to this sort key.
-
getComparer
public java.util.Comparator getComparer()
Get the comparer which is used to compare two values according to this sort key.
-
-