org.w3c.tools.sorter
Class Sorter

java.lang.Object
  extended by org.w3c.tools.sorter.Sorter

public class Sorter
extends java.lang.Object

This class implements a bunch of different ways of sorting things.


Constructor Summary
Sorter()
           
 
Method Summary
static void orderedFileInsert(java.io.File file, java.util.Vector into)
          Insert a File into a vector, maintaing the order:
static Comparable[] sortComparableArray(Comparable[] array, boolean inplace)
           
static java.util.Vector sortComparableEnumeration(java.util.Enumeration e)
          Sort the given Comparable enumeration.
static java.util.Vector sortComparableKeys(java.util.Hashtable h)
          Get the keys of this hashtable, sorted.
static java.lang.String[] sortStringArray(java.lang.String[] array, boolean inplace)
          Sort the given String array in place.
static java.util.Vector sortStringEnumeration(java.util.Enumeration e)
          Sort the given String enumeration.
static java.util.Vector sortStringKeys(java.util.Hashtable h)
          Get the keys of this hashtable, sorted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sorter

public Sorter()
Method Detail

orderedFileInsert

public static void orderedFileInsert(java.io.File file,
                                     java.util.Vector into)
Insert a File into a vector, maintaing the order:

Directory then files in alphabetical order.

Parameters:
file - The File used to sort.
into - The target sorted vector.

sortStringKeys

public static java.util.Vector sortStringKeys(java.util.Hashtable h)
Get the keys of this hashtable, sorted.

Parameters:
h - The hashtable whose String keys are wanted.

sortStringEnumeration

public static java.util.Vector sortStringEnumeration(java.util.Enumeration e)
Sort the given String enumeration.

Returns:
A sorted vector of String.

sortComparableKeys

public static java.util.Vector sortComparableKeys(java.util.Hashtable h)
Get the keys of this hashtable, sorted.

Parameters:
h - The hashtable whose Comparable keys are wanted.

sortComparableEnumeration

public static java.util.Vector sortComparableEnumeration(java.util.Enumeration e)
Sort the given Comparable enumeration.

Returns:
A sorted vector of Comparable instance.

sortStringArray

public static java.lang.String[] sortStringArray(java.lang.String[] array,
                                                 boolean inplace)
Sort the given String array in place.

Parameters:
array - The array of String to sort.
inplace - Sort the array in place if true, allocate a fresh array for the result otherwise.
Returns:
The same array, with string sorted.

sortComparableArray

public static Comparable[] sortComparableArray(Comparable[] array,
                                               boolean inplace)