byucc.jhdl.util
Class Sort

java.lang.Object
  extended bybyucc.jhdl.util.Sort

public class Sort
extends java.lang.Object

A class that provides some static sort methods for arrays of Objects.


Constructor Summary
Sort()
           
 
Method Summary
static void bubbleSortAscending(java.lang.Object[] elements, Comparator comp)
          Sort the objects in elements in ascending order as determined by comp.
static void bubbleSortDescending(java.lang.Object[] elements, Comparator comp)
          Sort the objects in elements in descending order as determined by comp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sort

public Sort()
Method Detail

bubbleSortAscending

public static void bubbleSortAscending(java.lang.Object[] elements,
                                       Comparator comp)
Sort the objects in elements in ascending order as determined by comp. This method uses a bubble sort which has complexity O(n^2).

Parameters:
elements - an array of objects to be sorted.
comp - a Comparator used to determine ordering of elements.

bubbleSortDescending

public static void bubbleSortDescending(java.lang.Object[] elements,
                                        Comparator comp)
Sort the objects in elements in descending order as determined by comp. This method uses a bubble sort which has complexity O(n^2).

Parameters:
elements - an array of objects to be sorted.
comp - a Comparator used to determine ordering of elements.


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.