| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Class for performing "instrumented" sorts and searches (where we count how many comparisons and swaps were needed). This class provides convenience methods; subclasses implement various sort/search algorithms. (See source code at Sorter.java.)
| Inner Class Summary | |
public static class | Sorter.SearchResult Class to hold counter and "found" values resulting from a search. |
public static class | Sorter.SortResult Class to hold counter values resulting from a sort. |
| Method Summary | |
static boolean | isSorted(Object[] a, Comparator c)Tests whether array is sorted. |
static void | printArray(String msg, Object[] a)Prints array, preceded by header message. |
static void | printSearchResult(String testName, String searchName, Object[] a, Object x, SearchResult r)Shows results of testing search: Tests result and prints values of counters, preceded by header message. |
static void | printSortResult(String testName, String sortName, Object[] a, Comparator c, SortResult r)Shows results of testing sort: Tests result and prints values of counters, preceded by header message. |
static void | printSortResult(String testName, String sortName, Object[] a, Comparator c, SortResult r, boolean copyNotSwap)Shows results of testing sort: Tests result and prints values of counters, preceded by header message. |
| Method Detail |
public static boolean isSorted(Object[] a, Comparator c)
public static void printArray(String msg, Object[] a)
public static void printSearchResult(String testName, String searchName, Object[] a, Object x, SearchResult r)
public static void printSortResult(String testName, String sortName, Object[] a, Comparator c, SortResult r)
public static void printSortResult(String testName, String sortName, Object[] a, Comparator c, SortResult r, boolean copyNotSwap)
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||