Crossfire JXClient, Trunk
|
Public Member Functions | |
void | destroy () |
String | getAppletInfo () |
String[][] | getParameterInfo () |
void | init () |
void | mouseClicked (MouseEvent e) |
void | mouseEntered (MouseEvent e) |
void | mouseExited (MouseEvent e) |
void | mousePressed (MouseEvent e) |
void | mouseReleased (MouseEvent e) |
void | paint (Graphics g) |
void | run () |
void | start () |
synchronized void | stop () |
void | update (Graphics g) |
Package Functions | |
void | pause () |
void | pause (int H1) |
void | pause (int H1, int H2) |
void | scramble () |
Package Attributes | |
String | algName |
SortAlgorithm | algorithm |
int | arr [] |
int | h1 = -1 |
int | h2 = -1 |
Dimension | initialSize = null |
Private Member Functions | |
synchronized void | startSort () |
Private Attributes | |
Thread | kicker |
A simple applet class to demonstrate a sort algorithm. You can specify a sorting algorithm using the "alg" attribute. When you click on the applet, a thread is forked which animates the sorting algorithm.
Definition at line 58 of file SortItem.java.
void SortItem.destroy | ( | ) |
Deallocate resources of applet.
Definition at line 168 of file SortItem.java.
String SortItem.getAppletInfo | ( | ) |
Definition at line 319 of file SortItem.java.
String [][] SortItem.getParameterInfo | ( | ) |
Definition at line 324 of file SortItem.java.
void SortItem.init | ( | ) |
Initialize the applet.
Definition at line 143 of file SortItem.java.
void SortItem.mouseClicked | ( | MouseEvent | e | ) |
Definition at line 293 of file SortItem.java.
void SortItem.mouseEntered | ( | MouseEvent | e | ) |
Definition at line 311 of file SortItem.java.
void SortItem.mouseExited | ( | MouseEvent | e | ) |
Definition at line 315 of file SortItem.java.
void SortItem.mousePressed | ( | MouseEvent | e | ) |
Definition at line 298 of file SortItem.java.
void SortItem.mouseReleased | ( | MouseEvent | e | ) |
The user clicked in the applet. Start the clock!
Definition at line 305 of file SortItem.java.
void SortItem.paint | ( | Graphics | g | ) |
Paint the array of numbers as a list of horizontal lines of varying lengths.
Definition at line 177 of file SortItem.java.
References a.
|
package |
Pause a while.
Definition at line 111 of file SortItem.java.
Referenced by SortAlgorithm.pause().
|
package |
Pause a while, and draw the high water mark.
Definition at line 119 of file SortItem.java.
|
package |
Pause a while, and draw the low&high water marks.
Definition at line 127 of file SortItem.java.
void SortItem.run | ( | ) |
Run the sorting algorithm. This method is called by class Thread once the sorting algorithm is started.
Definition at line 250 of file SortItem.java.
References SortAlgorithm.init(), SortAlgorithm.setParent(), and SortAlgorithm.sort().
|
package |
Fill the array with random numbers from 0..n-1.
Definition at line 90 of file SortItem.java.
void SortItem.start | ( | ) |
Definition at line 157 of file SortItem.java.
|
private |
For a Thread to actually do the sorting. This routine makes sure we do not simultaneously start several sorts if the user repeatedly clicks on the sort item. It needs to be synchronized with the stop() method because they both manipulate the common kicker variable.
Definition at line 285 of file SortItem.java.
synchronized void SortItem.stop | ( | ) |
Stop the applet. Kill any sorting algorithm that is still sorting.
Definition at line 267 of file SortItem.java.
References SortAlgorithm.stop().
void SortItem.update | ( | Graphics | g | ) |
Update without erasing the background.
Definition at line 238 of file SortItem.java.
|
package |
The name of the algorithm.
Definition at line 80 of file SortItem.java.
|
package |
The sorting algorithm (or null).
Definition at line 84 of file SortItem.java.
|
package |
The array that is being sorted.
Definition at line 68 of file SortItem.java.
|
package |
The high water mark.
Definition at line 72 of file SortItem.java.
Referenced by SortAlgorithm.pause().
|
package |
The low water mark.
Definition at line 76 of file SortItem.java.
Referenced by SortAlgorithm.pause().
|
package |
Definition at line 85 of file SortItem.java.
|
private |
The thread that is sorting (or null).
Definition at line 64 of file SortItem.java.