JML

org.jmlspecs.jmlunit.strategies
Class ShortCompositeIterator

java.lang.Object
  extended byorg.jmlspecs.jmlunit.strategies.ShortAbstractIterator
      extended byorg.jmlspecs.jmlunit.strategies.ShortCompositeIterator
All Implemented Interfaces:
Cloneable, IndefiniteIterator, ShortIterator

public class ShortCompositeIterator
extends ShortAbstractIterator

Composition of several ShortIterators.

Author:
Gary T. Leavens
See Also:
ShortIterator

Field Summary
private  int currentIterator
          What iterator we are working with now.
private  ShortIterator[] iters
          The iterators that are being sequenced
 
Constructor Summary
protected ShortCompositeIterator(int currentIterator, ShortIterator[] iters)
          Initialize this composite to iterate over clones of the given iterators, in order, starting at the given current iterator.
  ShortCompositeIterator(ShortIterator iter)
          Initialize this composite to iterate over the given iterator.
  ShortCompositeIterator(ShortIterator iter1, ShortIterator iter2)
          Initialize this composite to iterate over the given iterators, in order.
  ShortCompositeIterator(ShortIterator[] iters)
          Initialize this composite to iterate over clones of the given iterators, in order.
 
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.
 short getShort()
          Return the next element in this iteration.
private  void setCurrentIterator()
          Set the current iterator to the next one that has elements, if any.
 String toString()
           
 
Methods inherited from class org.jmlspecs.jmlunit.strategies.ShortAbstractIterator
get
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentIterator

private int currentIterator
What iterator we are working with now.


iters

private final ShortIterator[] iters
The iterators that are being sequenced

Constructor Detail

ShortCompositeIterator

public ShortCompositeIterator(ShortIterator iter)
Initialize this composite to iterate over the given iterator.


ShortCompositeIterator

public ShortCompositeIterator(ShortIterator iter1,
                              ShortIterator iter2)
Initialize this composite to iterate over the given iterators, in order.


ShortCompositeIterator

public ShortCompositeIterator(ShortIterator[] iters)
Initialize this composite to iterate over clones of the given iterators, in order.


ShortCompositeIterator

protected ShortCompositeIterator(int currentIterator,
                                 ShortIterator[] iters)
Initialize this composite to iterate over clones of the given iterators, in order, starting at the given current iterator.

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?


getShort

public short getShort()
               throws NoSuchElementException
Return the next element in this iteration.

Throws:
NoSuchElementException;
NoSuchElementException

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.


setCurrentIterator

private void setCurrentIterator()
Set the current iterator to the next one that has elements, if any.


clone

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

Specified by:
clone in interface ShortIterator
Overrides:
clone in class ShortAbstractIterator

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.