Package org.htmlparser.util.sort
Class Sort
java.lang.Object
org.htmlparser.util.sort.Sort
A 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
Modifier and TypeMethodDescriptionstatic int
Binary search for an objectstatic int
Binary search for an objectstatic int
Binary search for an objectstatic int
Binary search for an objectstatic int
Binary search for an objectstatic int
Binary search for an objectstatic void
This is a string version of C.A.R Hoare's Quick Sort algorithm.static void
This is a string version of C.A.R Hoare's Quick Sort algorithm.static Object[]
Sort a Hashtable.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.static void
This is a generic version of C.A.R Hoare's Quick Sort algorithm.
-
Method Details
-
QuickSort
This 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
- AVector
ofOrdered
items.- Throws:
ClassCastException
- If the vector contains objects that are notOrdered
.
-
QuickSort
This 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
- AVector
ofOrdered
items.lo0
- Left boundary of vector partition.hi0
- Right boundary of vector partition.- Throws:
ClassCastException
- If the vector contains objects that are notOrdered
.
-
QuickSort
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 ofOrdered
items.
-
QuickSort
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 ofOrdered
items.lo0
- Left boundary of array partition.hi0
- Right boundary of array partition.
-
QuickSort
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 ofString
items.
-
QuickSort
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 ofString
items.lo0
- Left boundary of array partition.hi0
- Right boundary of array partition.
-
QuickSort
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
- ASortable
object.lo0
- Left boundary of partition.hi0
- Right boundary of partition.
-
QuickSort
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
- ASortable
object.
-
QuickSort
Sort a Hashtable.- Parameters:
h
- A Hashtable with String or Ordered keys.- Returns:
- A sorted array of the keys.
- Throws:
ClassCastException
- If the keys of the hashtable are notOrdered
.
-
bsearch
Binary search for an object- Parameters:
set
- The collection ofOrdered
objects.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
Binary search for an object- Parameters:
set
- The collection ofOrdered
objects.ref
- The name to search for.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
Binary search for an object- Parameters:
vector
- The vector ofOrdered
objects.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
Binary search for an object- Parameters:
vector
- The vector ofOrdered
objects.ref
- The name to search for.- Returns:
- The index at which reference was found or is to be inserted.
-
bsearch
Binary search for an object- Parameters:
array
- The array ofOrdered
objects.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
Binary search for an object- Parameters:
array
- The array ofOrdered
objects.ref
- The name to search for.- Returns:
- The index at which reference was found or is to be inserted.
-