org.gcube.indexmanagement.geo.ranking
Class Sorter

java.lang.Object
  extended by org.gcube.indexmanagement.geo.ranking.Sorter

public class Sorter
extends Object

A utility class used to sort objects using the quick sort and partial quick sort sorting algorithms. See http://en.wikipedia.org/wiki/Quicksort (or any data structures & algorithm text book) for an explanation of the quick sort algorithm.


Constructor Summary
Sorter()
           
 
Method Summary
static
<T> void
partialQuickSort(List<T> objects, int start, int end, boolean isSeriallySorted, Comparator<T> comparator)
          A method used to sort a list of objects using a specified comparator and the partial quick sort algorithm
static
<T> void
quickSort(List<T> objects, Comparator<T> comparator)
          A method used to sort a list of objects using a specified comparator and the quick sort algorithm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sorter

public Sorter()
Method Detail

quickSort

public static <T> void quickSort(List<T> objects,
                                 Comparator<T> comparator)
A method used to sort a list of objects using a specified comparator and the quick sort algorithm

Type Parameters:
T - The Type of the List to sort
Parameters:
objects - - The list to sort
comparator - - The comparator to use during sorting

partialQuickSort

public static <T> void partialQuickSort(List<T> objects,
                                        int start,
                                        int end,
                                        boolean isSeriallySorted,
                                        Comparator<T> comparator)
A method used to sort a list of objects using a specified comparator and the partial quick sort algorithm

Type Parameters:
T - The Type of the List to sort
Parameters:
objects - - The list to sort
start - - The starting point of the list part to sort (inclusive)
end - - The ending point of the list part to sort (inclusive)
isSeriallySorted - - an indicator of whether the list is being serially sorted (ie. are all parts before the current start index already sorted?)
comparator - - The comparator to use during sorting


Copyright © 2013. All Rights Reserved.