Class Sorter.QuickSorter<T>

  • Enclosing class:
    Sorter<T>

    public static final class Sorter.QuickSorter<T>
    extends Sorter<T>
    Sorter implementation for QuickSort. This is basically a fork of the mahout, in-place quick-sort with a couple minor modifications
    • Field Summary

      • Fields inherited from class com.complexible.common.base.Sorter

        c
    • Constructor Summary

      Constructors 
      Constructor Description
      QuickSorter​(java.util.Comparator<? super T> c)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Comparable<? super T>>
      void
      quickSort​(T[] array, int start, int end)
      Sort the specified range of an array of object that implement the Comparable interface.
      static <T> void quickSort​(T[] array, int start, int end, java.util.Comparator<T> comp)
      Sorts the specified range in the array in a specified order.
      void sort​(T[] array, int start, int end)  
      • Methods inherited from class com.complexible.common.base.Sorter

        create
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QuickSorter

        public QuickSorter​(java.util.Comparator<? super T> c)
    • Method Detail

      • sort

        public void sort​(T[] array,
                         int start,
                         int end)
        Specified by:
        sort in class Sorter<T>
      • quickSort

        public static <T> void quickSort​(T[] array,
                                         int start,
                                         int end,
                                         java.util.Comparator<T> comp)
        Sorts the specified range in the array in a specified order.
        Parameters:
        array - the array to be sorted.
        start - the start index to sort.
        end - the last + 1 index to sort.
        comp - the comparator.
        Throws:
        java.lang.IllegalArgumentException - if start > end.
        java.lang.ArrayIndexOutOfBoundsException - if start < 0 or end > array.length.
      • quickSort

        public static <T extends java.lang.Comparable<? super T>> void quickSort​(T[] array,
                                                                                 int start,
                                                                                 int end)
        Sort the specified range of an array of object that implement the Comparable interface.
        Type Parameters:
        T - The type of object.
        Parameters:
        array - the array.
        start - the first index.
        end - the last index (exclusive).