All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class spec.harness.QuickSort

spec.harness.QuickSort

public class QuickSort
This class implements the quick sort algorithm. Given the array of strings, this class provides the functions to sort them


Constructor Index

 o QuickSort()

Method Index

 o compare(String, String)
Compares two strings lexicographically.
 o sort(String)
Sorts the sub strings (which are seperated by "\n") in a string
 o sort(String, boolean)
Tokenizes the given string by looking for '\n' and sorts the resulting string array.
 o sort(String[])
Sorts the string array passed
 o startSort(String[])
Starts the sorting of strings.

Constructors

 o QuickSort
 public QuickSort()

Methods

 o startSort
 public void startSort(String userArray[])
Starts the sorting of strings.

Parameters:
userArray - Array of String objects to be sorted
 o compare
 public int compare(String a,
                    String b)
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.

Parameters:
a - First string
b - Second string
Returns:
the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.
 o sort
 public static String[] sort(String args[])
Sorts the string array passed

Parameters:
args - Array of strings to be sorted
 o sort
 public static String sort(String text,
                           boolean comments)
Tokenizes the given string by looking for '\n' and sorts the resulting string array. Constructs back the string object with the sorted entries and returns the resultant string object.

Parameters:
text - Text to be sorted
comments - Flag indicating whether the resulting string should have line feeds or not
 o sort
 public static String sort(String text)
Sorts the sub strings (which are seperated by "\n") in a string


All Packages  Class Hierarchy  This Package  Previous  Next  Index