Package net.sf.saxon.expr.sort
Class DocumentSorter
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.UnaryExpression
-
- net.sf.saxon.expr.sort.DocumentSorter
-
- All Implemented Interfaces:
java.io.Serializable,javax.xml.transform.SourceLocator,LocationProvider,SaxonLocator,InstructionInfo,org.xml.sax.Locator
public class DocumentSorter extends UnaryExpression
A DocumentSorter is an expression that sorts a sequence of nodes into document order.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.UnaryExpression
operand
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description DocumentSorter(Expression base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomputeSpecialProperties()Get the static properties of this expression (other than its type).Expressioncopy()Copy an expression.booleaneffectiveBooleanValue(XPathContext context)Get the effective boolean value of the expression.voidexplain(ExpressionPresenter out)Diagnostic print of expression structure.ItemOrderComparergetComparer()java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.SequenceIteratoriterate(XPathContext context)Return an Iterator to iterate over the values of a sequence.Expressionoptimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)Perform optimisation of an expression and its subexpressions.Expressionpromote(PromotionOffer offer, Expression parent)Promote this expression if possibleExpressionsimplify(ExpressionVisitor visitor)Simplify an expression-
Methods inherited from class net.sf.saxon.expr.UnaryExpression
computeCardinality, displayOperator, equals, getBaseExpression, getItemType, hashCode, iterateSubExpressions, replaceSubExpression, toString, typeCheck
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getHostLanguage, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, iterateSameFocusSubExpressions, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, typeError
-
-
-
-
Constructor Detail
-
DocumentSorter
public DocumentSorter(Expression base)
-
-
Method Detail
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classExpression- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
getComparer
public ItemOrderComparer getComparer()
-
simplify
public Expression simplify(ExpressionVisitor visitor) throws XPathException
Description copied from class:UnaryExpressionSimplify an expression- Overrides:
simplifyin classUnaryExpression- Parameters:
visitor- an expression visitor- Returns:
- the simplified expression
- Throws:
XPathException- if an error is discovered during expression rewriting
-
optimize
public Expression optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
Description copied from class:UnaryExpressionPerform optimisation of an expression and its subexpressions.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.
- Overrides:
optimizein classUnaryExpression- Parameters:
visitor- an expression visitorcontextItemType- 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 toType.ITEM_TYPE- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
computeSpecialProperties
public int computeSpecialProperties()
Description copied from class:UnaryExpressionGet the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.- Overrides:
computeSpecialPropertiesin classUnaryExpression- Returns:
- the special properties, as a bit-significant integer
-
copy
public Expression copy()
Copy an expression. This makes a deep copy.- Specified by:
copyin classExpression- Returns:
- the copy of the original expression
-
promote
public Expression promote(PromotionOffer offer, Expression parent) throws XPathException
Promote this expression if possible- Overrides:
promotein classUnaryExpression- Parameters:
offer- details of the offer, for example the offer to move expressions that don't depend on the context to an outer level in the containing expressionparent- the containing expression in the expression tree- Returns:
- if the offer is not accepted, return this expression unchanged. Otherwise return the result of rewriting the expression to promote this subexpression
- Throws:
XPathException- if any error is detected
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Description copied from class:ExpressionReturn an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.- Overrides:
iteratein classExpression- Parameters:
context- supplies the context for evaluation- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
effectiveBooleanValue
public boolean effectiveBooleanValue(XPathContext context) throws XPathException
Description copied from class:ExpressionGet the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.- Overrides:
effectiveBooleanValuein classExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
explain
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Overrides:
explainin classUnaryExpression- Parameters:
out- the expression presenter used to display the structure
-
-