lima.mathematical.factorisation.trialdivision
Class EratosthenesSieve.Iterator

java.lang.Object
  |
  +--lima.mathematical.factorisation.trialdivision.EratosthenesSieve.Iterator
Enclosing class:
EratosthenesSieve

public class EratosthenesSieve.Iterator
extends java.lang.Object

An object of this class is created by a Sieve of Eratosthenes object. It will iteratively supply each of those prime numbers that were generated when the parent sieve object was initially constructed, in the order of increasing size.


Method Summary
 boolean hasNext()
          Determine whether or not an iterator object is able to supply another prime number.
 int next()
          Obtain the next prime number from an iterator object assuming another prime number is available.
 void reset()
          Reset an iterator object, so that the next prime number to be supplied will be the first prime number available from the parent sieve object (starting from the lowest).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()
Determine whether or not an iterator object is able to supply another prime number. The method returns true if another prime number is available, and false if there is not.


next

public int next()
Obtain the next prime number from an iterator object assuming another prime number is available. If none are available a new IllegalStateException is thrown.

Throws:
java.lang.IllegalStateException

reset

public void reset()
Reset an iterator object, so that the next prime number to be supplied will be the first prime number available from the parent sieve object (starting from the lowest).