|
eaLib API Docs Last Modified : January 7 2002 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mss.ea.core.ListSort
Implementation of various sort algorithms.
The algorithms should work with all data structures implmenting the list interface. The list
must contain only elements that implement the comparable interface. The user has to assure this
constraint or else a ClassCastException is thrown.
The original code is written by Laurentiu Christofor and was extended for lists. That is the reason
the license conditions of Laurentiu are printed here:
Copyright (c) 1999 Laurentiu Cristofor
Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies.
I MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. I SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
Field Summary | |
protected static int |
assignCount
Number of assignments made. |
protected static int |
compareCount
Number of comparisons made. |
Constructor Summary | |
ListSort()
|
Method Summary | |
static void |
bubbleSort(java.util.List list)
Bubble sort. |
static void |
bubbleSort2(java.util.List list)
Bubble sort according to Sedgewick. |
protected static void |
deltaInsertionSort(java.util.List list,
int left,
int right,
int delta)
Helper for Shell Sort. |
protected static void |
exchange(java.util.List list,
int indexA,
int indexB)
Exchanges two list elements. |
static void |
heapSort(java.util.List list)
Heap Sort. |
static void |
insertionSort(java.util.List list)
Insertion Sort. |
static void |
printresult()
Prints both counters to System.out. |
static void |
resetCounter()
Set both internal counter to zero. |
static void |
selectionSort(java.util.List list)
Selection Sort. |
static void |
shellSort(java.util.List list)
Shell Sort. |
protected static void |
siftDown(java.util.List list,
int i,
int n)
Helper for Heap Sort. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static int assignCount
protected static int compareCount
Constructor Detail |
public ListSort()
Method Detail |
public static void bubbleSort(java.util.List list)
list
- list to be sortedpublic static void bubbleSort2(java.util.List list)
list
- list to be sortedpublic static void heapSort(java.util.List list)
list
- list to be sortedprotected static void siftDown(java.util.List list, int i, int n)
list
- i
- n
- public static void insertionSort(java.util.List list)
list
- list to be sortedpublic static void selectionSort(java.util.List list)
list
- list to be sortedpublic static void shellSort(java.util.List list)
list
- list to be sortedprotected static void deltaInsertionSort(java.util.List list, int left, int right, int delta)
list
- left
- right
- delta
- public static void resetCounter()
protected static void exchange(java.util.List list, int indexA, int indexB)
list
- list with elements to be exchangedindexA
- index of the first elementindexB
- index of the second elementpublic static void printresult()
|
eaLib API Docs Last Modified : January 7 2002 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |