net.sf.saxon.sort

Class SortKeyDefinition

public class SortKeyDefinition extends Object implements Serializable

A 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.
Field Summary
protected StringbaseURI
protected ExpressioncaseOrder
protected Comparatorcollation
protected ExpressioncollationName
protected ExpressiondataTypeExpression
protected booleanemptyLeast
protected Expressionlanguage
protected Expressionorder
protected ContainerparentExpression
protected ExpressionsortKey
Method Summary
StringgetBaseURI()
ExpressiongetCaseOrder()
ComparatorgetCollation()
ExpressiongetCollationName()
ExpressiongetDataTypeExpression()
booleangetEmptyLeast()
ExpressiongetLanguage()
ExpressiongetOrder()
ContainergetParentExpression()
ExpressiongetSortKey()
Get the expression used as the sort key
FixedSortKeyDefinitionreduce(XPathContext context)
Evaluate any aspects of the sort definition that were specified as AVTs, for example ascending/descending, language, case-order, data-type.
voidsetBaseURI(String baseURI)
voidsetCaseOrder(Expression exp)
Set the case order.
voidsetCollation(Comparator collation)
voidsetCollationName(Expression collationName)
Set the collation.
voidsetDataTypeExpression(Expression exp)
Set the data type.
voidsetEmptyLeast(boolean emptyLeast)
Set whether empty sequence comes before other values or after them
voidsetLanguage(Expression exp)
Set the language.
voidsetOrder(Expression exp)
Set the order.
voidsetParentExpression(Container container)
voidsetSortKey(Expression exp)
Set the expression used as the sort key
SortKeyDefinitionsimplify(StaticContext env, Executable exec)

Field Detail

baseURI

protected String baseURI

caseOrder

protected Expression caseOrder

collation

protected Comparator collation

collationName

protected Expression collationName

dataTypeExpression

protected Expression dataTypeExpression

emptyLeast

protected boolean emptyLeast

language

protected Expression language

order

protected Expression order

parentExpression

protected Container parentExpression

sortKey

protected Expression sortKey

Method Detail

getBaseURI

public String getBaseURI()

getCaseOrder

public Expression getCaseOrder()

getCollation

public Comparator getCollation()

getCollationName

public Expression getCollationName()

getDataTypeExpression

public Expression getDataTypeExpression()

getEmptyLeast

public boolean getEmptyLeast()

getLanguage

public Expression getLanguage()

getOrder

public Expression getOrder()

getParentExpression

public Container getParentExpression()

getSortKey

public Expression getSortKey()
Get the expression used as the sort key

reduce

public FixedSortKeyDefinition reduce(XPathContext context)
Evaluate any aspects of the sort definition that were specified as AVTs, for example ascending/descending, language, case-order, data-type. This is done at the start of each sort. A FixedSortKeyDefinition is a SortKeyDefinition in which these properties are all known values.

setBaseURI

public void setBaseURI(String baseURI)

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".

setCollation

public void setCollation(Comparator collation)

setCollationName

public void setCollationName(Expression collationName)
Set the collation.

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.

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

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").

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".

setParentExpression

public void setParentExpression(Container container)

setSortKey

public void setSortKey(Expression exp)
Set the expression used as the sort key

simplify

public SortKeyDefinition simplify(StaticContext env, Executable exec)