net.sf.saxon.expr.flwor
Class OrderByClausePush

java.lang.Object
  extended by net.sf.saxon.expr.flwor.TuplePush
      extended by net.sf.saxon.expr.flwor.OrderByClausePush
All Implemented Interfaces:
Sortable

public class OrderByClausePush
extends TuplePush
implements Sortable

Represents the tuple stream delivered by an "order by" clause. This sorts the tuple stream supplied as its input, and outputs the same tuples but in sorted order.


Field Summary
protected  AtomicComparer[] comparers
           
 
Constructor Summary
OrderByClausePush(TuplePush destination, TupleExpression tupleExpr, OrderByClause orderBy, XPathContext context)
           
 
Method Summary
 void close()
          Close the tuple stream, indicating that no more tuples will be delivered
 int compare(int a, int b)
          Compare two objects within this Sortable, identified by their position.
 void processTuple(XPathContext context)
          Process the next tuple.
 void swap(int a, int b)
          Swap two objects within this Sortable, identified by their position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparers

protected AtomicComparer[] comparers
Constructor Detail

OrderByClausePush

public OrderByClausePush(TuplePush destination,
                         TupleExpression tupleExpr,
                         OrderByClause orderBy,
                         XPathContext context)
Method Detail

processTuple

public void processTuple(XPathContext context)
                  throws XPathException
Process the next tuple.

Specified by:
processTuple in class TuplePush
Parameters:
context - the dynamic evaluation context
Throws:
XPathException - if a dynamic error occurs

compare

public int compare(int a,
                   int b)
Compare two objects within this Sortable, identified by their position.

Specified by:
compare in interface Sortable
Returns:
<0 if obj[a]0 if obj[a]>obj[b]

swap

public void swap(int a,
                 int b)
Swap two objects within this Sortable, identified by their position.

Specified by:
swap in interface Sortable

close

public void close()
           throws XPathException
Close the tuple stream, indicating that no more tuples will be delivered

Overrides:
close in class TuplePush
Throws:
XPathException - if a dynamic error occurs


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.