JML

org.jmlspecs.models
Class JMLValueBagEnumerator

java.lang.Object
  extended byorg.jmlspecs.models.JMLValueBagEnumerator
All Implemented Interfaces:
Cloneable, Enumeration, JMLEnumeration, JMLType, JMLValueType, Serializable

public class JMLValueBagEnumerator
extends Object
implements JMLEnumeration, JMLValueType

Enumerators for bags (i.e., multisets) of values.

Version:
$Revision: 1.42 $
Author:
Gary T. Leavens, with help from Albert Baker, Clyde Ruby, and others.
See Also:
JMLEnumeration, JMLType, JMLValueBag, JMLEnumerationToIterator

Field Summary
protected  JMLValueBag currentBag
          The elements that have not yet been returned by nextElement.
protected  int currentCount
          The remaining count of repetitions that the current entry should be returned.
protected  JMLType currEntry
          The current entry.
 
Constructor Summary
(package private) JMLValueBagEnumerator(JMLValueBag b)
          Initialize this with the given bag.
 
Method Summary
protected  JMLValueBag abstractValue()
          Return the abstract value of this bag enumerator.
 Object clone()
          Return a clone of this enumerator.
 boolean equals(Object oth)
          Return true just when this enumerator has the same state as the given argument..
 int hashCode()
          Return a hash code for this enumerator.
 boolean hasMoreElements()
          Tells whether this enumerator has more uniterated elements.
 Object nextElement()
          Return the next element in this, if there is one.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentBag

protected JMLValueBag currentBag
The elements that have not yet been returned by nextElement. The bag underlying this enumerator.


currentCount

protected int currentCount
The remaining count of repetitions that the current entry should be returned.


currEntry

protected JMLType currEntry
The current entry.

Constructor Detail

JMLValueBagEnumerator

JMLValueBagEnumerator(JMLValueBag b)
Initialize this with the given bag.

Method Detail

hasMoreElements

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

Specified by:
hasMoreElements in interface JMLEnumeration

nextElement

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

Specified by:
nextElement in interface Enumeration
Throws:
JMLNoSuchElementException - when this is empty.

clone

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

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

abstractValue

protected JMLValueBag abstractValue()
Return the abstract value of this bag enumerator.


equals

public boolean equals(Object oth)
Return true just when this enumerator 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 enumerator.

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.