Class ArraySort
public class ArraySort extends Sort
{
// Methods
protected int compare(int p, int q);
static public void sort(Object array[], Comparison comparison);
static public void sort(Object array[], Comparison comparison,
int first, int size);
protected void swap(int p, int q);
}
This class sorts an Object array using a Comparison object.
Sort
|
+--ArraySort
protected int compare(int p, int q);
Compares two elements in the array using the Comparison object.
Return Value:
Returns the result of the comparison.
| Parameter | Description |
| p
| The index of the first operand of the comparison.
|
| q
| The index of the second operand of the comparison.
|
Overrides:
compare(int,int) in Sort.
static public void sort(Object array[], Comparison comparison);
Sorts the specified Object array using a Comparison object.
Return Value:
No return value.
| Parameter | Description |
| array
| The Object array to sort.
|
| comparison
| The Comparison object to use.
|
static public void sort(Object array[], Comparison comparison, int first,
int size);
Sorts a subrange of the specified Object array using a Comparison object.
Return Value:
No return value.
| Parameter | Description |
| array
| The Object array to sort.
|
| comparison
| The Comparison to use.
|
| first
| The beginning element of the subrange.
|
| size
| The number of elements in the subrange.
|
protected void swap(int p, int q);
Swaps two elements in the array.
Return Value:
No return value.
| Parameter | Description |
| p
| The index of the first operand of the swap operation.
|
| q
| The index of the second operand of the swap operation.
|
Overrides:
swap(int,int) in Sort.