|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.amino.alg.sort.AbstractSorter
org.amino.alg.sort.DefaultSorter
public class DefaultSorter
This is the simple default sorter class. Lots of room for improving the implementation. Uses the array and list sorting routines. Provides functions to sort by ascending and descending orders.
Constructor Summary | |
---|---|
DefaultSorter()
|
Method Summary | ||
---|---|---|
void |
reverse(byte[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
reverse(char[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
reverse(double[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
reverse(float[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
reverse(int[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
|
reverse(java.util.List<T> a,
int from,
int to)
|
|
void |
reverse(long[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
reverse(short[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
|
reverse(T[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
|
void |
sort(byte[] a,
int from,
int to)
|
|
void |
sort(char[] a,
int from,
int to)
|
|
void |
sort(double[] a,
int from,
int to)
|
|
void |
sort(float[] a,
int from,
int to)
|
|
void |
sort(int[] a,
int from,
int to)
|
|
|
sort(java.util.List<T> a)
|
|
|
sort(java.util.List<T> a,
java.util.Comparator<T> c)
|
|
|
sort(java.util.List<T> a,
int from,
int to)
|
|
|
sort(java.util.List<T> a,
int from,
int to,
java.util.Comparator<T> c)
|
|
void |
sort(long[] a,
int from,
int to)
|
|
void |
sort(short[] a,
int from,
int to)
|
|
|
sort(T[] a,
int from,
int to)
|
|
|
sort(T[] a,
int from,
int to,
java.util.Comparator<T> c)
|
|
void |
sortp(int[] p,
int[] a,
int from,
int to)
Sort array and return a permuted index vector. |
Methods inherited from class org.amino.alg.sort.AbstractSorter |
---|
reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, sort, sort, sort, sort, sort, sort, sort, sort, sort, swap, swap, swap, swap, swap, swap, swap, swap, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultSorter()
Method Detail |
---|
public void reverse(byte[] a, int from, int to)
Sorter
a
- is the byte array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(char[] a, int from, int to)
Sorter
a
- is the character array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(short[] a, int from, int to)
Sorter
a
- is the short array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(int[] a, int from, int to)
Sorter
a
- is the int array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(long[] a, int from, int to)
Sorter
a
- is the long array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(float[] a, int from, int to)
Sorter
a
- is the float array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void reverse(double[] a, int from, int to)
Sorter
a
- is the double array to be sorted in a descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic <T extends java.lang.Comparable<T>> void reverse(T[] a, int from, int to)
Sorter
T
- data typea
- is the array of Comparable objects to be sorted in a
descending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic <T extends java.lang.Comparable<T>> void reverse(java.util.List<T> a, int from, int to)
T
- data typea
- is the List of Comparable objects to be sorted in a descending
orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(byte[] a, int from, int to)
a
- is the byte array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(byte[], int, int)
public void sort(char[] a, int from, int to)
a
- is the character array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(byte[], int, int)
public void sort(short[] a, int from, int to)
a
- is the short array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void sort(int[] a, int from, int to)
a
- is the int array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void sort(long[] a, int from, int to)
a
- is the long array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void sort(float[] a, int from, int to)
a
- is the float array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void sort(double[] a, int from, int to)
a
- is the double array to be sorted in an ascending orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public <T extends java.lang.Comparable<T>> void sort(T[] a, int from, int to)
T
- data typea
- is an array of Comparable objects to be sorted in an ascending
orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(Object[], int, int)
public <T extends java.lang.Comparable<T>> void sort(T[] a, int from, int to, java.util.Comparator<T> c)
T
- data typea
- is an array of Comparable objects to be sortedc
- is the Comparatorfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(Object[], int, int, Comparator)
public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a, int from, int to)
T
- data typea
- is a List of Comparable objects to be sorted in an ascending
orderfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedCollections.sort(List)
public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a, int from, int to, java.util.Comparator<T> c)
T
- data typea
- is a List of Comparable objects to be sortedc
- is the Comparatorfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedCollections.sort(List, Comparator)
public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a)
AbstractSorter
sort
in interface Sorter
sort
in class AbstractSorter
T
- data typea
- is a List of Comparable objects to be sorted in an ascending
orderCollections.sort(List)
public <T extends java.lang.Comparable<T>> void sort(java.util.List<T> a, java.util.Comparator<T> c)
AbstractSorter
sort
in interface Sorter
sort
in class AbstractSorter
T
- data typea
- is a List of Comparable objects to be sortedc
- is the ComparatorCollections.sort(List, Comparator)
public void sortp(int[] p, int[] a, int from, int to)
Sorter
p
- is the returned permuted index vectora
- is the array to be sorted, based on which the permuted index
vector is generatedfrom
- is the start indexto
- is the end index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |