JML

org.jmlspecs.jmlunit.strategies
Class DoubleArrayIterator

java.lang.Object
  extended byorg.jmlspecs.jmlunit.strategies.DoubleAbstractIterator
      extended byorg.jmlspecs.jmlunit.strategies.DoubleArrayIterator
All Implemented Interfaces:
Cloneable, DoubleIterator, IndefiniteIterator

public class DoubleArrayIterator
extends DoubleAbstractIterator

A DoubleIterator over arrays of double elements.

Author:
Gary T. Leavens

Field Summary
private  double[] elems
          The elements
private  int next
          The next element's index (zero based)
 
Constructor Summary
  DoubleArrayIterator(double[] elems)
          Initialize this iterator to iterate over a clone of the array
protected DoubleArrayIterator(int next, double[] elems)
          Initialize this iterator to iterate over a clone of the array, starting at the given next index
 
Method Summary
 void advance()
          Advance the state of this iteration to the next position.
 boolean atEnd()
          Is this iterator at its end?
 Object clone()
          Return a copy of this iterator in the same state as this object.
 double getDouble()
          Return the current double in this iterator.
 String toString()
           
 
Methods inherited from class org.jmlspecs.jmlunit.strategies.DoubleAbstractIterator
get
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

private int next
The next element's index (zero based)


elems

private double[] elems
The elements

Constructor Detail

DoubleArrayIterator

public DoubleArrayIterator(double[] elems)
Initialize this iterator to iterate over a clone of the array


DoubleArrayIterator

protected DoubleArrayIterator(int next,
                              double[] elems)
Initialize this iterator to iterate over a clone of the array, starting at the given next index

Method Detail

atEnd

public boolean atEnd()
Description copied from interface: IndefiniteIterator
Is this iterator at its end? That is, if we called get(), would it throw an exception?


getDouble

public double getDouble()
Description copied from interface: DoubleIterator
Return the current double in this iterator.


advance

public void advance()
Description copied from interface: IndefiniteIterator
Advance the state of this iteration to the next position. Note that this never throws an exception.


clone

public Object clone()
Description copied from interface: DoubleIterator
Return a copy of this iterator in the same state as this object.

Specified by:
clone in interface DoubleIterator
Overrides:
clone in class DoubleAbstractIterator

toString

public String toString()
Overrides:
toString 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.