edu.rit.hyb.prime
Class Prime32List
- java.lang.Object
-
- edu.rit.hyb.prime.Prime32List
-
public class Prime32List extends java.lang.ObjectClass Prime32List encapsulates a list of 32-bit prime numbers. The list of prime numbers is obtained by reading a sequence of values from a file. Each value is an unsigned byte. Each value is the difference between two consecutive odd primes, divided by 2. The file must be created by the Prime32File program.Class Prime32List provides a method for creating an iterator. The numbers returned by the iterator are the odd primes in ascending order: 3, 5, 7, 11, and so on. The numbers are returned as type long. Once the iterator has read all numbers from the prime file, the iterator returns 0 to signal that there are no more numbers.
-
-
Constructor Summary
Constructors Constructor and Description Prime32List(java.io.File primeFile)Construct a new 32-bit prime list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description LongIteratoriterator()Obtain an iterator for the primes in this 32-bit prime list.
-
-
-
Constructor Detail
-
Prime32List
public Prime32List(java.io.File primeFile)
Construct a new 32-bit prime list. The prime numbers are contained in the given file.- Parameters:
primeFile- Prime file.
-
-
Method Detail
-
iterator
public LongIterator iterator() throws java.io.IOException
Obtain an iterator for the primes in this 32-bit prime list.- Returns:
- Iterator.
- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
-
DMelt 3.0 © DataMelt by jWork.ORG