|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.amino.alg.sort.AbstractSorter
public abstract class AbstractSorter
This is the abstract sorting class that implements the Sorter interface. The subclasses will provide the sort and reverse methods.
Constructor Summary | |
---|---|
AbstractSorter()
|
Method Summary | ||
---|---|---|
void |
reverse(byte[] a)
Sort array using reverse natural (descending) order. |
|
void |
reverse(char[] a)
Sort array using reverse natural (descending) order. |
|
void |
reverse(double[] a)
Sort array using reverse natural (descending) order. |
|
void |
reverse(float[] a)
Sort array using reverse natural (descending) order. |
|
void |
reverse(int[] a)
Sort array using reverse natural (descending) order. |
|
|
reverse(java.util.List<T> a)
Sort List using reverse natural (descending) order. |
|
void |
reverse(long[] a)
Sort array using reverse natural (descending) order. |
|
void |
reverse(short[] a)
Sort array using reverse natural (descending) order. |
|
|
reverse(T[] a)
Sort array using reverse natural (descending) order. |
|
void |
sort(byte[] a)
|
|
void |
sort(char[] a)
|
|
void |
sort(double[] a)
|
|
void |
sort(float[] a)
|
|
void |
sort(int[] a)
|
|
|
sort(java.util.List<T> a)
|
|
|
sort(java.util.List<T> a,
java.util.Comparator<T> c)
|
|
void |
sort(long[] a)
|
|
void |
sort(short[] a)
|
|
|
sort(T[] a)
|
|
|
sort(T[] a,
java.util.Comparator<T> c)
|
|
protected static void |
swap(byte[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(char[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(double[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(float[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(int[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(long[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swap(short[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static
|
swap(T[] a,
int i,
int j)
swap two specified positions in the array. |
|
protected static void |
swapIfGreater(byte[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(char[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(double[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(float[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(int[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(long[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfGreater(short[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static
|
swapIfGreater(T[] a,
int i,
int j)
swap two specified positions in the array, if the first value is greater than the second one. |
|
protected static void |
swapIfLess(byte[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(char[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(double[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(float[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(int[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(long[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static void |
swapIfLess(short[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
|
protected static
|
swapIfLess(T[] a,
int i,
int j)
swap two specified positions in the array, if the first value is less than the second one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.amino.alg.sort.Sorter |
---|
reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, sortp |
Constructor Detail |
---|
public AbstractSorter()
Method Detail |
---|
public void sort(byte[] a)
sort
in interface Sorter
a
- is the byte array to be sorted in an ascending orderArrays.sort(byte[])
public void sort(char[] a)
sort
in interface Sorter
a
- is the character array to be sorted in an ascending orderArrays.sort(byte[])
public void sort(short[] a)
sort
in interface Sorter
a
- is the short array to be sorted in an ascending orderArrays.sort(short[])
public void sort(int[] a)
sort
in interface Sorter
a
- is the int array to be sorted in an ascending orderArrays.sort(short[])
public void sort(long[] a)
sort
in interface Sorter
a
- is the long array to be sorted in an ascending orderArrays.sort(short[])
public void sort(float[] a)
sort
in interface Sorter
a
- is the float array to be sorted in an ascending orderArrays.sort(short[])
public void sort(double[] a)
sort
in interface Sorter
a
- is the double array to be sorted in an ascending orderArrays.sort(short[])
public void reverse(byte[] a)
Sorter
reverse
in interface Sorter
a
- is the byte array to be sorted in a descending orderpublic void reverse(char[] a)
Sorter
reverse
in interface Sorter
a
- is the character array to be sorted in a descending orderpublic void reverse(short[] a)
Sorter
reverse
in interface Sorter
a
- is the short array to be sorted in a descending orderpublic void reverse(int[] a)
Sorter
reverse
in interface Sorter
a
- is the int array to be sorted in a descending orderpublic void reverse(long[] a)
Sorter
reverse
in interface Sorter
a
- is the long array to be sorted in a descending orderpublic void reverse(float[] a)
Sorter
reverse
in interface Sorter
a
- is the float array to be sorted in a descending orderpublic void reverse(double[] a)
Sorter
reverse
in interface Sorter
a
- is the double array to be sorted in a descending orderpublic <T extends java.lang.Comparable<T>> void sort(T[] a)
sort
in interface Sorter
T
- data typea
- array upon which to operate.Arrays.sort(Object[])
public <T extends java.lang.Comparable<T>> void sort(T[] a, java.util.Comparator<T> c)
sort
in interface Sorter
T
- data typea
- array upon which to operate.c
- comparator used to do comparisonArrays.sort(Object[], Comparator)
public <T extends java.lang.Comparable<T>> void reverse(T[] a)
reverse
in interface Sorter
T
- data typea
- array upon which to operate.public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a)
sort
in interface Sorter
T
- data typea
- array upon which to operate.Collections.sort(List)
public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a, java.util.Comparator<T> c)
sort
in interface Sorter
T
- data typea
- array upon which to operate.c
- comparator used to do comparisonCollections.sort(List, Comparator)
public <T extends java.lang.Comparable<T>> void reverse(java.util.List<T> a)
reverse
in interface Sorter
T
- data typea
- array upon which to operate.protected static void swap(byte[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(byte[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(byte[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(char[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(char[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(char[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(short[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(short[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(short[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(int[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(int[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(int[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(long[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(long[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(long[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(float[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(float[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(float[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swap(double[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfGreater(double[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static void swapIfLess(double[] a, int i, int j)
a
- the arrayi
- the first positionj
- the second positionprotected static <T> void swap(T[] a, int i, int j)
T
- data typea
- the arrayi
- the first positionj
- the second positionprotected static <T extends java.lang.Comparable<T>> void swapIfGreater(T[] a, int i, int j)
T
- data typea
- the arrayi
- the first positionj
- the second positionprotected static <T extends java.lang.Comparable<T>> void swapIfLess(T[] a, int i, int j)
T
- data typea
- the arrayi
- the first positionj
- the second position
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |