weka.classifiers.misc.monotone
Class EnumerationIterator

java.lang.Object
  extended by weka.classifiers.misc.monotone.EnumerationIterator
All Implemented Interfaces:
java.util.Iterator, RevisionHandler

public class EnumerationIterator
extends java.lang.Object
implements java.util.Iterator, RevisionHandler

Implementation of a simple wrapper class for the Enumeration interface. This makes it possible to use an Enumeration as if it were an Iterator.

This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.

Version:
$Revision: 1.2 $
Author:
Stijn Lievens (stijn.lievens@ugent.be)

Constructor Summary
EnumerationIterator(java.util.Enumeration e)
          Construct an EnumerationIterator on basis of on Enumeration.
 
Method Summary
 java.lang.String getRevision()
          Returns the revision string.
 boolean hasNext()
          Returns true if there are more elements in the iteration.
 java.lang.Object next()
          Returns the next element in the iteration.
 void remove()
          Since the iteration is based on an enumeration, removal of elements is not supported.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationIterator

public EnumerationIterator(java.util.Enumeration e)
Construct an EnumerationIterator on basis of on Enumeration.

Parameters:
e - the Enumeration on which the Iterator will be based
Method Detail

hasNext

public final boolean hasNext()
Returns true if there are more elements in the iteration.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if there are more elements in the iteration, false otherwise

next

public final java.lang.Object next()
                            throws java.util.NoSuchElementException
Returns the next element in the iteration.

Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - if the requested element does not exist

remove

public final void remove()
Since the iteration is based on an enumeration, removal of elements is not supported.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - every time this method is invoked

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Returns:
the revision