com.amazon.carbonado.qe
Class SortedQueryExecutor<S extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.qe.AbstractQueryExecutor<S>
      extended by com.amazon.carbonado.qe.SortedQueryExecutor<S>
All Implemented Interfaces:
QueryExecutor<S>

public class SortedQueryExecutor<S extends Storable>
extends AbstractQueryExecutor<S>

QueryExecutor which wraps another and sorts the results.

Author:
Brian S O'Neill
See Also:
SortedCursor

Nested Class Summary
static class SortedQueryExecutor.ArraySortSupport<S extends Storable>
           
static class SortedQueryExecutor.MergeSortSupport<S extends Storable>
           
static interface SortedQueryExecutor.Support<S extends Storable>
          Provides support for SortedQueryExecutor.
 
Constructor Summary
SortedQueryExecutor(SortedQueryExecutor.Support<S> support, QueryExecutor<S> executor, OrderingList<S> handledOrdering, OrderingList<S> remainderOrdering)
           
 
Method Summary
 long count(FilterValues<S> values)
          Counts results by opening a cursor and skipping entries.
 Cursor<S> fetch(FilterValues<S> values)
          Returns a new cursor using the given filter values.
 Filter<S> getFilter()
          Returns the filter used by this QueryExecutor.
 OrderingList<S> getOrdering()
          Returns the result ordering of this QueryExecutor.
 boolean printNative(Appendable app, int indentLevel, FilterValues<S> values)
          Prints native query of the wrapped executor.
 boolean printPlan(Appendable app, int indentLevel, FilterValues<S> values)
          Prints the query plan to any appendable, if applicable.
 
Methods inherited from class com.amazon.carbonado.qe.AbstractQueryExecutor
fetchSlice, getStorableType, increaseIndent, indent, newline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedQueryExecutor

public SortedQueryExecutor(SortedQueryExecutor.Support<S> support,
                           QueryExecutor<S> executor,
                           OrderingList<S> handledOrdering,
                           OrderingList<S> remainderOrdering)
Parameters:
support - optional support to control sort buffer; if null, array is used
executor - executor to wrap
handledOrdering - optional handled ordering
remainderOrdering - required remainder ordering
Throws:
IllegalArgumentException - if executor is null or if remainder ordering is empty
Method Detail

fetch

public Cursor<S> fetch(FilterValues<S> values)
                                 throws FetchException
Description copied from interface: QueryExecutor
Returns a new cursor using the given filter values.

Throws:
FetchException

count

public long count(FilterValues<S> values)
           throws FetchException
Description copied from class: AbstractQueryExecutor
Counts results by opening a cursor and skipping entries. Subclasses are encouraged to override with a more efficient implementation.

Specified by:
count in interface QueryExecutor<S extends Storable>
Overrides:
count in class AbstractQueryExecutor<S extends Storable>
Throws:
FetchException

getFilter

public Filter<S> getFilter()
Description copied from interface: QueryExecutor
Returns the filter used by this QueryExecutor.

Returns:
query filter, never null

getOrdering

public OrderingList<S> getOrdering()
Description copied from interface: QueryExecutor
Returns the result ordering of this QueryExecutor.

Returns:
query ordering in an unmodifiable list

printNative

public boolean printNative(Appendable app,
                           int indentLevel,
                           FilterValues<S> values)
                    throws IOException
Prints native query of the wrapped executor.

Specified by:
printNative in interface QueryExecutor<S extends Storable>
Overrides:
printNative in class AbstractQueryExecutor<S extends Storable>
values - optional
Returns:
false if not implemented
Throws:
IOException

printPlan

public boolean printPlan(Appendable app,
                         int indentLevel,
                         FilterValues<S> values)
                  throws IOException
Description copied from interface: QueryExecutor
Prints the query plan to any appendable, if applicable.

values - optional
Returns:
false if not implemented
Throws:
IOException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.