Package org.htmlparser.util.sort
Class Sort
- java.lang.Object
-
- org.htmlparser.util.sort.Sort
-
public class Sort extends java.lang.ObjectA quick sort algorithm to sort Vectors or arrays. Provides sort and binary search capabilities.This all goes away in JDK 1.2.
- Version:
- 1.4, 11 June, 1997
- Author:
- James Gosling, Kevin A. Smith, Derrick Oswald
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intbsearch(java.util.Vector vector, Ordered ref)Binary search for an objectstatic intbsearch(java.util.Vector vector, Ordered ref, int lo, int hi)Binary search for an objectstatic intbsearch(Ordered[] array, Ordered ref)Binary search for an objectstatic intbsearch(Ordered[] array, Ordered ref, int lo, int hi)Binary search for an objectstatic intbsearch(Sortable set, Ordered ref)Binary search for an objectstatic intbsearch(Sortable set, Ordered ref, int lo, int hi)Binary search for an objectstatic voidQuickSort(java.lang.String[] a)This is a string version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(java.lang.String[] a, int lo0, int hi0)This is a string version of C.A.R Hoare's Quick Sort algorithm.static java.lang.Object[]QuickSort(java.util.Hashtable h)Sort a Hashtable.static voidQuickSort(java.util.Vector v)This is a generic version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(java.util.Vector v, int lo0, int hi0)This is a generic version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(Ordered[] a)This is a generic version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(Ordered[] a, int lo0, int hi0)This is a generic version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(Sortable sortable)This is a generic version of C.A.R Hoare's Quick Sort algorithm.static voidQuickSort(Sortable sortable, int lo0, int hi0)This is a generic version of C.A.R Hoare's Quick Sort algorithm.
-
-
-
Method Detail
-
QuickSort
public static void QuickSort(java.util.Vector v) throws java.lang.ClassCastExceptionThis is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle vectors that are already sorted, and vectors with duplicate keys. Equivalent to:QuickSort (v, 0, v.size () - 1);
- Parameters:
v- AVectorofOrdereditems.- Throws:
java.lang.ClassCastException- If the vector contains objects that are notOrdered.
-
QuickSort
public static void QuickSort(java.util.Vector v, int lo0, int hi0) throws java.lang.ClassCastExceptionThis is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle vectors that are already sorted, and vectors with duplicate keys.If you think of a one dimensional vector as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right.
- Parameters:
v- AVectorofOrdereditems.lo0- Left boundary of vector partition.hi0- Right boundary of vector partition.- Throws:
java.lang.ClassCastException- If the vector contains objects that are notOrdered.
-
QuickSort
public static void QuickSort(Ordered[] a)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.Equivalent to:
QuickSort (a, 0, a.length - 1);
- Parameters:
a- An array ofOrdereditems.
-
QuickSort
public static void QuickSort(Ordered[] a, int lo0, int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right.
- Parameters:
a- An array ofOrdereditems.lo0- Left boundary of array partition.hi0- Right boundary of array partition.
-
QuickSort
public static void QuickSort(java.lang.String[] a)
This is a string version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.Equivalent to:
QuickSort (a, 0, a.length - 1);
- Parameters:
a- An array ofStringitems.
-
QuickSort
public static void QuickSort(java.lang.String[] a, int lo0, int hi0)This is a string version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right.
- Parameters:
a- An array ofStringitems.lo0- Left boundary of array partition.hi0- Right boundary of array partition.
-
QuickSort
public static void QuickSort(Sortable sortable, int lo0, int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle Sortable objects that are already sorted, and Sortable objects with duplicate keys.- Parameters:
sortable- ASortableobject.lo0- Left boundary of partition.hi0- Right boundary of partition.
-
QuickSort
public static void QuickSort(Sortable sortable)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle Sortable objects that are already sorted, and Sortable objects with duplicate keys.Equivalent to:
QuickSort (sortable, sortable.first (), sortable.last ());
- Parameters:
sortable- ASortableobject.
-
QuickSort
public static java.lang.Object[] QuickSort(java.util.Hashtable h) throws java.lang.ClassCastExceptionSort a Hashtable.- Parameters:
h- A Hashtable with String or Ordered keys.- Returns:
- A sorted array of the keys.
- Throws:
java.lang.ClassCastException- If the keys of the hashtable are notOrdered.
-
bsearch
public static int bsearch(Sortable set, Ordered ref, int lo, int hi)
Binary search for an object- Parameters:
set- The collection ofOrderedobjects.ref- The name to search for.lo- The lower index within which to look.hi- The upper index within which to look.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
public static int bsearch(Sortable set, Ordered ref)
Binary search for an object- Parameters:
set- The collection ofOrderedobjects.ref- The name to search for.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
public static int bsearch(java.util.Vector vector, Ordered ref, int lo, int hi)Binary search for an object- Parameters:
vector- The vector ofOrderedobjects.ref- The name to search for.lo- The lower index within which to look.hi- The upper index within which to look.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
public static int bsearch(java.util.Vector vector, Ordered ref)Binary search for an object- Parameters:
vector- The vector ofOrderedobjects.ref- The name to search for.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
public static int bsearch(Ordered[] array, Ordered ref, int lo, int hi)
Binary search for an object- Parameters:
array- The array ofOrderedobjects.ref- The name to search for.lo- The lower index within which to look.hi- The upper index within which to look.- Returns:
- The index at which reference was found or is to be inserted.
-
-