Order the Book

coreservlets
Class PrimeList

java.lang.Object
  |
  +--coreservlets.PrimeList

public class PrimeList
extends Object
implements Runnable

Creates a Vector of large prime numbers, usually in a low-priority background thread. Provides a few small thread-safe access methods.

Taken from Core Servlets and JavaServer Pages from Prentice Hall and Sun Microsystems Press, http://www.coreservlets.com/. © 2000 Marty Hall; may be freely used or adapted.


Constructor Summary
PrimeList(int numPrimes, int numDigits, boolean runInBackground)
          Finds numPrimes prime numbers, each of which are numDigits long or longer.
 
Method Summary
 Vector getPrimes()
           
 boolean isDone()
           
 int numCalculatedPrimes()
           
 int numDigits()
           
 int numPrimes()
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimeList

public PrimeList(int numPrimes,
                 int numDigits,
                 boolean runInBackground)
Finds numPrimes prime numbers, each of which are numDigits long or longer. You can set it to only return when done, or have it return immediately, and you can later poll it to see how far it has gotten.
Method Detail

run

public void run()
Specified by:
run in interface Runnable

isDone

public boolean isDone()

getPrimes

public Vector getPrimes()

numDigits

public int numDigits()

numPrimes

public int numPrimes()

numCalculatedPrimes

public int numCalculatedPrimes()

Order the Book

Order
CSAJSP @ amazon.com

Return to Top-Level Source Code Archive