|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jcon.util.ArraySorter
public class ArraySorter
Sorts an array using a Comparer. All static methods. Initially only a few sort types are supported. The example has many. From Nutshell Examples page 36 with minor modifications.
| Nested Class Summary | |
|---|---|
static class |
ArraySorter.ASCIIComparer
Compares assuming the String is only ASCII. |
static interface |
ArraySorter.Comparer
The interface implementation should compare the two objects and return an int using these rules: if (a > b) return > 0; if (a == b) return 0; if (a < b) return < 0; For example to sort a String array: ClassName implements ArraySorter.Comparer public int compare(Object a, Object b) { return (the proper int); } |
| Field Summary | |
|---|---|
static ArraySorter.ASCIIComparer |
asciiComparer
|
| Constructor Summary | |
|---|---|
ArraySorter()
|
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Performs a simple unit test by sorting command arguments. |
static void |
sort(java.lang.Object[] a,
ArraySorter.Comparer comparer)
Sorts the array in ascending order using the Comparer. |
static void |
sort(java.lang.Object[] a,
java.lang.Object[] b,
int from,
int to,
boolean ascending,
ArraySorter.Comparer comparer)
Sorts both arrays. |
static void |
sortASCII(java.lang.String[] a)
Sorts an ASCII String array in ascending order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ArraySorter.ASCIIComparer asciiComparer
| Constructor Detail |
|---|
public ArraySorter()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public static void sortASCII(java.lang.String[] a)
public static void sort(java.lang.Object[] a,
ArraySorter.Comparer comparer)
public static void sort(java.lang.Object[] a,
java.lang.Object[] b,
int from,
int to,
boolean ascending,
ArraySorter.Comparer comparer)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||