FileDocCategorySizeDatePackage
SortAlgorithm.javaAPI DocExample2252Tue Dec 12 18:57:46 GMT 2000None

SortAlgorithm

public class SortAlgorithm extends Object
A generic sort demonstration algorithm SortAlgorithm.java, Thu Oct 27 10:32:35 1994
author
James Gosling
version
1.6f, 31 Jan 1995

Fields Summary
private SortItem
parent
The sort item.
protected boolean
stopRequested
When true stop sorting.
Constructors Summary
Methods Summary
public voidinit()
Initialize

	stopRequested = false;
    
protected voidpause()
Pause for a while.

	if (stopRequested) {
	    throw new Exception("Sort Algorithm");
	}
	parent.pause(parent.h1, parent.h2);
    
protected voidpause(int H1)
Pause for a while and mark item 1.

	if (stopRequested) {
	    throw new Exception("Sort Algorithm");
	}
	parent.pause(H1, parent.h2);
    
protected voidpause(int H1, int H2)
Pause for a while and mark item 1 & 2.

	if (stopRequested) {
	    throw new Exception("Sort Algorithm");
	}
	parent.pause(H1, H2);
    
public voidsetParent(SortItem p)
Set the parent.


            
        
	parent = p;
    
voidsort(int[] a)
This method will be called to sort an array of integers.

    
public voidstop()
Stop sorting.

	stopRequested = true;