JML

org.jmlspecs.models
Class JMLValueToValueRelationEnumerator

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

public class JMLValueToValueRelationEnumerator
extends Object
implements JMLEnumeration, JMLValueType

Enumerator for pairs of keys of type JMLType to values of type JMLType that form the associations in a relation.

Version:
$Revision: 1.41 $
Author:
Gary T. Leavens
See Also:
JMLEnumeration, JMLValueType, JMLValueToValueRelationImageEnumerator, JMLValueToValueRelation, JMLValueToValueMap, JMLEnumerationToIterator, JMLValueSet

Field Summary
protected  JMLValueSetEnumerator imageEnum
          An enumerator for the range elements that are related to the key that have not yet been returned.
protected  JMLValueToValueRelationImageEnumerator imagePairEnum
          An enumerator for the image pairs in this relation.
protected  JMLType key
          The current key for pairs being enumerated.
 
Constructor Summary
(package private) JMLValueToValueRelationEnumerator(JMLValueToValueRelation rel)
          Initialize this with the given relation.
protected JMLValueToValueRelationEnumerator(JMLValueToValueRelationImageEnumerator ipEnum, JMLValueSetEnumerator iEnum, JMLType k)
           
 
Method Summary
protected  JMLValueSet abstractValue()
          Return the set of uniterated pairs from this 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 image pair in this, if there is one.
 JMLValueValuePair nextPair()
          Return the next pair in this, if there is one.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imagePairEnum

protected JMLValueToValueRelationImageEnumerator imagePairEnum
An enumerator for the image pairs in this relation.


key

protected JMLType key
The current key for pairs being enumerated.


imageEnum

protected JMLValueSetEnumerator imageEnum
An enumerator for the range elements that are related to the key that have not yet been returned.

Constructor Detail

JMLValueToValueRelationEnumerator

JMLValueToValueRelationEnumerator(JMLValueToValueRelation rel)
Initialize this with the given relation.


JMLValueToValueRelationEnumerator

protected JMLValueToValueRelationEnumerator(JMLValueToValueRelationImageEnumerator ipEnum,
                                            JMLValueSetEnumerator iEnum,
                                            JMLType k)
Method Detail

hasMoreElements

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

Specified by:
hasMoreElements in interface JMLEnumeration
See Also:
nextElement(), nextPair()

nextElement

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

Specified by:
nextElement in interface Enumeration
Throws:
JMLNoSuchElementException - when this is empty.
See Also:
hasMoreElements(), nextPair()

nextPair

public JMLValueValuePair nextPair()
                           throws JMLNoSuchElementException
Return the next pair in this, if there is one.

Throws:
JMLNoSuchElementException - when this is empty.
See Also:
hasMoreElements(), nextElement()

clone

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

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

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

abstractValue

protected JMLValueSet abstractValue()
Return the set of uniterated pairs from this enumerator.


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.