public class SelectionSort extends java.lang.Object implements SortingAlgorithm
SortingGophers to
allow sorting of any list of data.
This isn't declared as a singleton, since it has no actual overhead (no
state), so there's not strong reason to limit instantiation. However an
standardInstance() method is provided that provides a shared
instance.
You can also just use this via the handy convenience method
SortingLib.selectionSort(SortingGopher); that is actually the
recommended method.
Copyright 2000-2006 Partner Software, Inc.
| Constructor and Description |
|---|
SelectionSort()
Creates a new SelectionSort algorithm object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
sort(SortingGopher gopher)
Sorts using the given
SortingGopher. |
void |
sort(SortingGopher gopher,
int start,
int end)
Sorts using the given
SortingGopher over the given range (start <=
i < end). |
static SelectionSort |
standardInstance()
Returns a singleton shared instance.
|
public SelectionSort()
standardInstance() method.public static SelectionSort standardInstance()
public final void sort(SortingGopher gopher)
SortingAlgorithmSortingGopher.sort in interface SortingAlgorithmgopher - SortingGopher adapter for underlying array-like structure.public final void sort(SortingGopher gopher, int start, int end)
SortingAlgorithmSortingGopher over the given range (start <=
i < end).sort in interface SortingAlgorithmgopher - SortingGopher adapter for underlying array-like structure.start - starting index (0 is minimum) for sort region (inclusive)end - ending index for sort region (exclusive)