All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class AU.net.plugged.sort.QuickSort

java.lang.Object
   |
   +----AU.net.plugged.sort.QuickSort

public class QuickSort
extends Object
implements Runnable
Version: 0.1

Author: Chris Ryan

Company: Plugged In Software
P.O. Box 4130
St Lucia South
Brisbane Qld Australia 4067
http://www.plugged.net.au

Date: 28 January 1997

Purpose:
This class sorts a vector using the QuickSort algorithm.
Usage:
Modification


Variable Index

 o EXTENSION
For sorting by "extension" Strings, ie everything after the '.' in a filename.
 o INT
For sorting ints.
 o sort_flags
Sort flags, passed in some comparison tests
 o SORT_INTERFACE
For sorting by using the SortInterface callback method.
 o sort_listeners
The vector of listeners for this sort
 o sort_thread
The sorting thread
 o sort_vector
The vector to sort
 o STRING
For sorting Strings.

Constructor Index

 o QuickSort(Vector, int, Object)
Constructor - This can be used to run the sorting in a separate thread.

Method Index

 o addSortListener(SortListener)
Adds a SortListener who will receive the sort events that occur
 o getVersionString()
Returns the RCS version information for this class.
 o processSortEvent(SortEvent)
Processes a SortEvent.
 o quickSort(Vector)
Quicksorts a vector.
 o quickSort(Vector, int)
Quicksorts a vector, using the comparison type passed to determine the vector's contents.
 o removeSortListener(SortListener)
Removes a SortListener who no longer wants to catch QuickSort events.
 o run()
The sort thread run method
 o start()
Starts the thread

Variables

 o STRING
 public static final int STRING
For sorting Strings.

 o INT
 public static final int INT
For sorting ints.

 o EXTENSION
 public static final int EXTENSION
For sorting by "extension" Strings, ie everything after the '.' in a filename.

 o SORT_INTERFACE
 public static final int SORT_INTERFACE
For sorting by using the SortInterface callback method.

 o sort_vector
 protected Vector sort_vector
The vector to sort

 o sort_thread
 protected Thread sort_thread
The sorting thread

 o sort_listeners
 protected Vector sort_listeners
The vector of listeners for this sort

 o sort_flags
 public static Object sort_flags
Sort flags, passed in some comparison tests

Constructors

 o QuickSort
 public QuickSort(Vector v,
                  int priority,
                  Object flags)
Constructor - This can be used to run the sorting in a separate thread. It assumes that the SORT_INTERFACE comparison style is being used.

Parameters:
v - The vector containing the elements to sort
priority - the priority to run the sorting at
flags - any flags to pass to the comparison test

Methods

 o start
 public void start()
Starts the thread

 o run
 public void run()
The sort thread run method

 o quickSort
 public static void quickSort(Vector v,
                              int comparison_type)
Quicksorts a vector, using the comparison type passed to determine the vector's contents.

Parameters:
v - The vector containing the elements
comparison_type - The type of comparison for sorting
 o quickSort
 public static void quickSort(Vector v)
Quicksorts a vector. The objects within the vector must implement the SortInterface.

Parameters:
v - The vector containing the elements
 o addSortListener
 public void addSortListener(SortListener listener)
Adds a SortListener who will receive the sort events that occur

Parameters:
listener - Listener who wants to catch events
 o removeSortListener
 public void removeSortListener(SortListener listener)
Removes a SortListener who no longer wants to catch QuickSort events.

Parameters:
listener - Listener who no longer wants to catch events.
 o processSortEvent
 protected void processSortEvent(SortEvent e)
Processes a SortEvent.

Parameters:
e - SortEvent to process
 o getVersionString
 public static String getVersionString()
Returns the RCS version information for this class.

Returns:
Returns the RCS Revision string for this class

All Packages  Class Hierarchy  This Package  Previous  Next  Index