sdsu.util
Class SortedEnumeration

java.lang.Object
  |
  +--sdsu.util.SortedEnumeration

public class SortedEnumeration
extends java.lang.Object
implements java.util.Enumeration

SortedEnumeration is an enumerations that returns elements in sorted order. Requires that all elements of the source enumeration be of the type expected by the comparer provided to the constructor.


Constructor Summary
SortedEnumeration(java.util.Enumeration sourceEnumeration, Comparer order)
          Creates a new SortedEnumeration.
 
Method Summary
 boolean hasMoreElements()
          Returns true if the enumeration has more elements
 java.lang.Object nextElement()
          Returns the next element in the enumeration
static java.util.Enumeration string(java.util.Enumeration sourceEnumeration)
          Requires that the elements of sourceEnumeration be strings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedEnumeration

public SortedEnumeration(java.util.Enumeration sourceEnumeration,
                         Comparer order)
Creates a new SortedEnumeration. The elements of sourceEnumeration are return in sorted order indicated by order.
Throws:
java.lang.ClassCastException - If all elements of sourceEnumeration are not the type expected by the comparer order . ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Method Detail

hasMoreElements

public boolean hasMoreElements()
Returns true if the enumeration has more elements
Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Returns the next element in the enumeration
Specified by:
nextElement in interface java.util.Enumeration

string

public static java.util.Enumeration string(java.util.Enumeration sourceEnumeration)
Requires that the elements of sourceEnumeration be strings. Returns an enumeration with the elements of sourceEnumeration in increasing sorted order