Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.store.access
Interface SortObserver  view SortObserver download SortObserver.java


public interface SortObserver

A SortObserver is an object that is used as a callback by the sorter. It allows the sort client to do whatever they want from the context of a sort. It contains 2 callback methods: insertDuplicateKey() and insertNonDuplicateKey(). On each SortController.insert(), one or the other of these methods will be called, depending on whether the given row has a key that has been seen before or not.

Some sample uses include:

These are possible uses only. You, kind reader, may do whatever you wish with this forgiving interface.


Method Summary
 void addToFreeList(org.apache.derby.iapi.types.DataValueDescriptor[] objectArray, int maxFreeListSize)
           
 org.apache.derby.iapi.types.DataValueDescriptor[] getArrayClone()
           
 org.apache.derby.iapi.types.DataValueDescriptor[] insertDuplicateKey(org.apache.derby.iapi.types.DataValueDescriptor[] insertRow, org.apache.derby.iapi.types.DataValueDescriptor[] existingRow)
          Called prior to inserting a duplicate sort key.
 org.apache.derby.iapi.types.DataValueDescriptor[] insertNonDuplicateKey(org.apache.derby.iapi.types.DataValueDescriptor[] insertRow)
          Called prior to inserting a distinct sort key; in other words, the first time that a key is inserted into the sorter, this method is called.
 

Method Detail

insertNonDuplicateKey

public org.apache.derby.iapi.types.DataValueDescriptor[] insertNonDuplicateKey(org.apache.derby.iapi.types.DataValueDescriptor[] insertRow)
                                                                        throws org.apache.derby.iapi.error.StandardException
Called prior to inserting a distinct sort key; in other words, the first time that a key is inserted into the sorter, this method is called. Subsequent inserts with the same key generate a call to insertDuplicateKey() instead.

This method will most commonly be used to clone the row that is retained by the sorter, or possibly to do some initialization of that row.


insertDuplicateKey

public org.apache.derby.iapi.types.DataValueDescriptor[] insertDuplicateKey(org.apache.derby.iapi.types.DataValueDescriptor[] insertRow,
                                                                            org.apache.derby.iapi.types.DataValueDescriptor[] existingRow)
                                                                     throws org.apache.derby.iapi.error.StandardException
Called prior to inserting a duplicate sort key. This method will typically be used to perform some aggregation on a row that is going to be discarded by the sorter.


addToFreeList

public void addToFreeList(org.apache.derby.iapi.types.DataValueDescriptor[] objectArray,
                          int maxFreeListSize)

getArrayClone

public org.apache.derby.iapi.types.DataValueDescriptor[] getArrayClone()
                                                                throws org.apache.derby.iapi.error.StandardException