Class DocumentSorter

All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, InstructionInfo, Locator

public class DocumentSorter extends UnaryExpression
A DocumentSorter is an expression that sorts a sequence of nodes into document order.
See Also:
  • Constructor Details

    • DocumentSorter

      public DocumentSorter(Expression base)
  • Method Details

    • getExpressionName

      public String getExpressionName()
      Get a name identifying the kind of expression, in terms meaningful to a user.
      Overrides:
      getExpressionName in class Expression
      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: UnaryExpression
      Simplify an expression
      Overrides:
      simplify in class UnaryExpression
      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: UnaryExpression
      Perform 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:
      optimize in class UnaryExpression
      Parameters:
      visitor - an expression visitor
      contextItemType - 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_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: UnaryExpression
      Get 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:
      computeSpecialProperties in class UnaryExpression
      Returns:
      the special properties, as a bit-significant integer
    • copy

      public Expression copy()
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Returns:
      the copy of the original expression
    • promote

      public Expression promote(PromotionOffer offer, Expression parent) throws XPathException
      Promote this expression if possible
      Overrides:
      promote in class UnaryExpression
      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 expression
      parent - 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: Expression
      Return 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:
      iterate in class Expression
      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: Expression
      Get 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:
      effectiveBooleanValue in class Expression
      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:
      explain in class UnaryExpression
      Parameters:
      out - the expression presenter used to display the structure