Package ciir.umass.edu.utilities
Class Sorter
- java.lang.Object
-
- ciir.umass.edu.utilities.Sorter
-
public class Sorter extends java.lang.ObjectThis class contains the implementation of some simple sorting algorithms.- Version:
- 1.3 (July 29, 2008)
- Author:
- Van Dang
-
-
Constructor Summary
Constructors Constructor Description Sorter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]sort(double[] sortVal, boolean asc)Sort a double array using Interchange sort.static int[]sort(float[] sortVal, boolean asc)static int[]sort(int[] sortVal, boolean asc)Sort an integer array using Quick Sort.static int[]sort(java.util.List<java.lang.Integer> sortVal, boolean asc)Sort an integer array using Quick Sort.static int[]sortDesc(java.util.List<java.lang.Double> sortVal)Sort an double array using Quick Sort.static int[]sortLong(java.util.List<java.lang.Long> sortVal, boolean asc)Sort an long array using Quick Sort.static int[]sortString(java.util.List<java.lang.String> sortVal, boolean asc)
-
-
-
Method Detail
-
sort
public static int[] sort(double[] sortVal, boolean asc)Sort a double array using Interchange sort.- Parameters:
sortVal- The double array to be sorted.asc- TRUE to sort ascendingly, FALSE to sort descendingly.- Returns:
- The sorted indexes.
-
sort
public static int[] sort(float[] sortVal, boolean asc)
-
sort
public static int[] sort(int[] sortVal, boolean asc)Sort an integer array using Quick Sort.- Parameters:
sortVal- The integer array to be sorted.asc- TRUE to sort ascendingly, FALSE to sort descendingly.- Returns:
- The sorted indexes.
-
sort
public static int[] sort(java.util.List<java.lang.Integer> sortVal, boolean asc)Sort an integer array using Quick Sort.- Parameters:
sortVal- The integer array to be sorted.asc- TRUE to sort ascendingly, FALSE to sort descendingly.- Returns:
- The sorted indexes.
-
sortString
public static int[] sortString(java.util.List<java.lang.String> sortVal, boolean asc)
-
sortLong
public static int[] sortLong(java.util.List<java.lang.Long> sortVal, boolean asc)Sort an long array using Quick Sort.- Parameters:
sortVal- The long array to be sorted.asc- TRUE to sort ascendingly, FALSE to sort descendingly.- Returns:
- The sorted indexes.
-
sortDesc
public static int[] sortDesc(java.util.List<java.lang.Double> sortVal)
Sort an double array using Quick Sort.- Parameters:
sortVal- The double array to be sorted.- Returns:
- The sorted indexes.
-
-