org.apache.derby.impl.sql.execute
Class BasicSortObserver

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.BasicSortObserver
All Implemented Interfaces:
SortObserver
Direct Known Subclasses:
AggregateSortObserver, UniqueIndexSortObserver

public class BasicSortObserver
extends java.lang.Object
implements SortObserver

This is the most basic sort observer. It handles distinct sorts and non-distinct sorts.

Author:
jamie

Field Summary
protected  boolean distinct
           
protected  boolean doClone
           
private  ExecRow execRow
           
private  boolean reuseWrappers
           
private  java.util.Vector vector
           
 
Constructor Summary
BasicSortObserver(boolean doClone, boolean distinct, ExecRow execRow, boolean reuseWrappers)
          Simple constructor
 
Method Summary
 void addToFreeList(DataValueDescriptor[] objectArray, int maxFreeListSize)
           
 DataValueDescriptor[] getArrayClone()
           
private  DataValueDescriptor[] getClone(DataValueDescriptor[] origArray)
           
 DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] insertRow, DataValueDescriptor[] existingRow)
          Called prior to inserting a duplicate sort key.
 DataValueDescriptor[] insertNonDuplicateKey(DataValueDescriptor[] insertRow)
          Called prior to inserting a distinct sort key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doClone

protected boolean doClone

distinct

protected boolean distinct

reuseWrappers

private boolean reuseWrappers

execRow

private ExecRow execRow

vector

private java.util.Vector vector
Constructor Detail

BasicSortObserver

public BasicSortObserver(boolean doClone,
                         boolean distinct,
                         ExecRow execRow,
                         boolean reuseWrappers)
Simple constructor

Parameters:
doClone - If true, then rows that are retained by the sorter will be cloned. This is needed if language is reusing row wrappers.
distinct - If true, toss out duplicates. Otherwise, retain them.
execRow - ExecRow to use as source of clone for store.
reuseWrappers - Whether or not we can reuse the wrappers
Method Detail

insertNonDuplicateKey

public DataValueDescriptor[] insertNonDuplicateKey(DataValueDescriptor[] insertRow)
                                            throws StandardException
Called prior to inserting a distinct sort key.

Specified by:
insertNonDuplicateKey in interface SortObserver
Parameters:
insertRow - the current row that the sorter is on the verge of retaining
Returns:
the row to be inserted by the sorter. If null, then nothing is inserted by the sorter. Distinct sorts will want to return null.
Throws:
StandardException - never thrown

insertDuplicateKey

public DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] insertRow,
                                                DataValueDescriptor[] existingRow)
                                         throws StandardException
Called prior to inserting a duplicate sort key.

Specified by:
insertDuplicateKey in interface SortObserver
Parameters:
insertRow - the current row that the sorter is on the verge of retaining. It is a duplicate of existingRow.
existingRow - the row that is already in the the sorter which is a duplicate of insertRow
Returns:
the row to be inserted by the sorter. If null, then nothing is inserted by the sorter. Distinct sorts will want to return null.
Throws:
StandardException - never thrown

addToFreeList

public void addToFreeList(DataValueDescriptor[] objectArray,
                          int maxFreeListSize)
Specified by:
addToFreeList in interface SortObserver

getArrayClone

public DataValueDescriptor[] getArrayClone()
                                    throws StandardException
Specified by:
getArrayClone in interface SortObserver
Throws:
StandardException

getClone

private DataValueDescriptor[] getClone(DataValueDescriptor[] origArray)

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.