|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.co.ist.mwt.Sorter
A Sorter knows how to sort an array of objects which implement the Comparable interface; it should be constructed with the list, and then the elements should be read out using the normal Enumeration interface.
Field Summary | |
protected int |
nextElt
The index of the next element to return when enumerating |
protected Comparable[] |
sorted
The array of things to sort |
Constructor Summary | |
Sorter(Comparable[] objects)
Initialises the class; copies the array into a private sorted version of itself. |
Method Summary | |
protected void |
doInit(Comparable[] objects)
The real constructor, in a separate method so that the constructor can be overridden with something which wraps up the input objects with some Comparable type or similar. |
boolean |
hasMoreElements()
When enumerating the results of a sort, tells you if there are any more elements to be enumerated |
java.lang.Object |
nextElement()
When enumerating the results of a sort, returns the next element |
int |
numElements()
Returns the number of elements in the array we're dealing with |
void |
resetEnum()
When enumerating, reset so that the enumeration can begin from the start |
protected void |
sortMyArray()
Sorts the array contained in this object. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Comparable[] sorted
protected int nextElt
Constructor Detail |
public Sorter(Comparable[] objects)
Method Detail |
protected void sortMyArray()
protected void doInit(Comparable[] objects)
public void resetEnum()
public int numElements()
public boolean hasMoreElements()
public java.lang.Object nextElement()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |