Class Primes
java.lang.Object
it.unimi.di.prog2.h13.Primes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intIl prossimo potenziale numero primo.L'elenco di primi restituiti da next. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()private booleanisDivisibleByAFoundPrime(int n) Verifica senè divisibile per un dei primi infoundPrimes.next()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining, remove
-
Field Details
-
candidate
private int candidateIl prossimo potenziale numero primo. -
foundPrimes
-
-
Constructor Details
-
Primes
public Primes()Crea un generatore di numeri primi.
-
-
Method Details
-
hasNext
-
isDivisibleByAFoundPrime
private boolean isDivisibleByAFoundPrime(int n) Verifica senè divisibile per un dei primi infoundPrimes.- Parameters:
n- il numero da verificare.- Returns:
truesenè divisibile per un dei primi già trovati.
-
next
-