fr.univNantes.intcolls
Class BinaryLongSetIterator

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

public class BinaryLongSetIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.Long>

Iterator specialized for a BinaryLongSet.

Author:
Pierre-Olivier Terrisse.

Nested Class Summary
(package private) static class BinaryLongSetIterator.Context
          Context class
 
Field Summary
private  BinaryLongSetIterator.Context context
          Context of the Iterator.
private  long current
          Current value
private  boolean hasCurrent
          True if iterator has a current value
private  BinaryLongSet ref
          Reference set
 
Constructor Summary
BinaryLongSetIterator(BinaryLongSet ref)
          Constructor
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Long next()
          Returns the next Long element in the iteration.
 long nextLong()
          Returns the next long element in the iteration.
 void remove()
          Removes from the underlying collection the last long 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 BinaryLongSet ref
Reference set


current

private long current
Current value


hasCurrent

private boolean hasCurrent
True if iterator has a current value


context

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

Constructor Detail

BinaryLongSetIterator

public BinaryLongSetIterator(BinaryLongSet 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.Long>
Returns:
true if the iterator has more elements.

next

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

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

nextLong

public long nextLong()
Returns the next long element in the iteration.

Returns:
the next long 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 long element returned by the iterator

Specified by:
remove in interface java.util.Iterator<java.lang.Long>
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.