fr.univNantes.intcolls
Class BinaryIntSetIterator

java.lang.Object
  extended by fr.univNantes.intcolls.BinaryIntSetIterator
All Implemented Interfaces:
java.util.Iterator<java.lang.Integer>

public class BinaryIntSetIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.Integer>

Iterator implementation for the BinaryIntSet class.

Author:
Pierre-Olivier Terrisse.

Nested Class Summary
(package private) static class BinaryIntSetIterator.Context
          Context class
 
Field Summary
private  BinaryIntSetIterator.Context context
          Context of the Iterator.
private  int current
          Current value
private  boolean hasCurrent
          True if iterator has a current value
private  BinaryIntSet ref
          Reference set
 
Constructor Summary
BinaryIntSetIterator(BinaryIntSet ref)
          Constructor
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Integer next()
          Returns the next Integer element in the iteration.
 int nextInt()
          Returns the next int element in the iteration.
 void remove()
          Removes from the underlying collection the last integer element returned by the iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

private BinaryIntSet ref
Reference set


current

private int current
Current value


hasCurrent

private boolean hasCurrent
True if iterator has a current value


context

private BinaryIntSetIterator.Context context
Context of the Iterator. It speeds up the iteration over the set by keeping the current block in memory.

Constructor Detail

BinaryIntSetIterator

public BinaryIntSetIterator(BinaryIntSet ref)
Constructor

Parameters:
ref - reference set
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.

Specified by:
hasNext in interface java.util.Iterator<java.lang.Integer>
Returns:
true if the iterator has more elements.

next

public java.lang.Integer next()
Returns the next Integer element in the iteration.

Specified by:
next in interface java.util.Iterator<java.lang.Integer>
Returns:
the next Integer element in the iteration.
Throws:
java.util.NoSuchElementException - if iteration has no more elements.

nextInt

public int nextInt()
Returns the next int element in the iteration.

Returns:
the next int element in the iteration.
Throws:
java.util.NoSuchElementException - if iteration has no more elements.

remove

public void remove()
Removes from the underlying collection the last integer element returned by the iterator

Specified by:
remove in interface java.util.Iterator<java.lang.Integer>
Throws:
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.