oracle.dacf.util
Class AbstractSort
java.lang.Object
oracle.dacf.util.AbstractSort
- All Implemented Interfaces:
- Sortter
- Direct Known Subclasses:
- BiDirBubbleSort, BubbleSort, QuickSort
- public abstract class AbstractSort
- extends java.lang.Object
- implements Sortter
The abstract base class for the generic sorting routines.
You will need to define a comparison method using the Compare interface
and set the comparer before calling sort. If this is not done, then
an IllegalArgumentException will be thrown.
A default swapper is implemented so that it is not necessary to define an
instance of the Swapper interface.
- See Also:
Compare
,
Swapper
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
comparer
protected Compare comparer
swapper
protected Swapper swapper
sort
public abstract void sort(java.lang.Object[] a)
- Sorts the items.
- Specified by:
sort
in interface Sortter
- Parameters:
a
- the array of objects to be sorted.
- Throws:
java.lang.IllegalArgumentException
- if the comparer is not defined
setComparer
public void setComparer(Compare comp)
- Specified by:
setComparer
in interface Sortter
getComparer
public Compare getComparer()
- Specified by:
getComparer
in interface Sortter
setSwapper
public void setSwapper(Swapper swap)
- Specified by:
setSwapper
in interface Sortter
getSwapper
public Swapper getSwapper()
- Specified by:
getSwapper
in interface Sortter
Copyright © 1997, 2003, Oracle. All rights reserved.