public abstract class TimSorter extends Sorter
Sorter implementation based on the
 TimSort
 algorithm.
 This implementation is especially good at sorting partially-sorted arrays and sorts small arrays with binary sort.
NOTE:There are a few differences with the original implementation:
maxTempSlots
 equal to half of the length of the slice of data to sort.
 | Modifier | Constructor and Description | 
|---|---|
| protected  | TimSorter(int maxTempSlots)Create a new  TimSorter. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected abstract int | compareSaved(int i,
            int j)Compare element  ifrom the temporary storage with elementjfrom the slice to sort, similarly toSorter.compare(int, int). | 
| protected abstract void | copy(int src,
    int dest)Copy data from slot  srcto slotdest. | 
| protected abstract void | restore(int i,
       int j)Restore element  jfrom the temporary storage into sloti. | 
| protected abstract void | save(int i,
    int len)Save all elements between slots  iandi+leninto the temporary storage. | 
| void | sort(int from,
    int to)Sort the slice which starts at  from(inclusive) and ends atto(exclusive). | 
protected TimSorter(int maxTempSlots)
TimSorter.maxTempSlots - the maximum amount of extra memory to run mergespublic void sort(int from,
        int to)
Sorterfrom (inclusive) and ends at
  to (exclusive).protected abstract void copy(int src,
        int dest)
src to slot dest.protected abstract void save(int i,
        int len)
i and i+len
  into the temporary storage.protected abstract void restore(int i,
           int j)
j from the temporary storage into slot i.protected abstract int compareSaved(int i,
               int j)
i from the temporary storage with element
  j from the slice to sort, similarly to
  Sorter.compare(int, int).Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.