public abstract class QuickSorter extends Object
Base class for QuickSort implementations. Works with an abstract notion of a mutable array of slots addressed by their index. Makes no assumptions on the size or structure of the slots, or on the way they are compared.
 Not thread-safe because the contract for implementing subclasses is stateful:
 loadPivot(long) must update the internal state which is later accessed by
 isGreaterThanPivot(long) and isLessThanPivot(long).
 
| Constructor and Description | 
|---|
| QuickSorter() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected abstract boolean | isGreaterThanPivot(long index) | 
| protected abstract boolean | isLessThanPivot(long index) | 
| protected abstract void | loadPivot(long index)Loads the data from the given index as needed to satisfy later calls to  isLessThanPivot(long)andisGreaterThanPivot(long). | 
| void | sort(long startIndex,
    long length)Sort the part of the array that starts at the supplied index and has the supplied length. | 
| protected abstract void | swap(long index1,
    long index2)Swaps the contents of the slots at the supplied indices. | 
public final void sort(long startIndex,
                       long length)
startIndex - first index of the region to sortlength - length of the region to sortprotected abstract void loadPivot(long index)
isLessThanPivot(long)
 and isGreaterThanPivot(long).index - the index from which to load the data.protected abstract boolean isLessThanPivot(long index)
index - the supplied index.true if the slot at the supplied index is "less than" the slot remembered by the
 previous call to loadPivot(long); false otherwise.protected abstract boolean isGreaterThanPivot(long index)
index - the supplied index.true if the slot at the supplied index is "greater than" the slot remembered by the
 previous call to loadPivot(long); false otherwise.protected abstract void swap(long index1,
                             long index2)
index1 - the index from which to swap contents.index2 - the other index from which to swap contents.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.