JML

org.jmlspecs.models
Class JMLEnumerationToIterator

java.lang.Object
  extended byorg.jmlspecs.models.JMLEnumerationToIterator
All Implemented Interfaces:
Cloneable, Iterator, JMLIterator, JMLType, Serializable

public class JMLEnumerationToIterator
extends Object
implements JMLIterator

A wrapper that makes any JMLEnumeration into a JMLIterator that does not support the remove operation.

Version:
$Revision: 1.27 $
Author:
Gary T. Leavens
See Also:
JMLEnumeration, JMLIterator, Iterator

Field Summary
protected  JMLEnumeration theEnumeration
           
 
Constructor Summary
JMLEnumerationToIterator(JMLEnumeration e)
          Initialize this iterator with the given Enumeration.
 
Method Summary
 Object clone()
          Return a clone of this iterator.
 boolean equals(Object oth)
          Return true just when this iterator has the same state as the given argument.
 int hashCode()
          Return a hash code for this iterator.
 boolean hasNext()
          Tells whether this has more uniterated elements.
 Object next()
          Return the next element in this, if there is one.
 void remove()
          The remove operation is not supported in this type.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theEnumeration

protected final JMLEnumeration theEnumeration
Constructor Detail

JMLEnumerationToIterator

public JMLEnumerationToIterator(JMLEnumeration e)
Initialize this iterator with the given Enumeration. The enumeration is cloned.

Method Detail

hasNext

public boolean hasNext()
Tells whether this has more uniterated elements.

Specified by:
hasNext in interface JMLIterator

next

public Object next()
            throws JMLNoSuchElementException
Return the next element in this, if there is one.

Specified by:
next in interface Iterator
Throws:
JMLNoSuchElementException - when this is empty.

remove

public void remove()
            throws UnsupportedOperationException
The remove operation is not supported in this type. So remove always throws an UnsupportedOperationException.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException

clone

public Object clone()
Return a clone of this iterator.

Specified by:
clone in interface JMLIterator
Overrides:
clone in class Object

equals

public boolean equals(Object oth)
Return true just when this iterator has the same state as the given argument.

Specified by:
equals in interface JMLType
Overrides:
equals in class Object

hashCode

public int hashCode()
Return a hash code for this iterator.

Specified by:
hashCode in interface JMLType
Overrides:
hashCode in class Object

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.