public class PrimesCache
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
CACHE_EMPTY
Empty cache status
|
static boolean |
CACHING_FINISHED
Cache ready to use
|
static int |
DEFAULT_MAX_NUM_IN_CACHE
Default range of integer to store in cache
|
static int |
IS_NOT_PRIME
Indicator if given number is not a prime
|
static int |
IS_PRIME
Indicator if given number is a prime
|
static int |
NOT_IN_CACHE
Indicator that the value is not stored
in cache
|
Constructor and Description |
---|
PrimesCache()
Default constructor - setting prime cache for a default range if integers
|
PrimesCache(int maxNumInCache)
Constructor - setting prime cache for a given range if integers
|
Modifier and Type | Method and Description |
---|---|
boolean |
getCacheStatus()
Returns cache status
|
double |
getComputingTime()
Returns computing time of Eratosthenes Sieve
|
int |
getMaxNumInCache()
Returns cache range.
|
int |
getNumberOfPrimes()
Returns number of found primes.
|
int |
primeTest(int n)
Check whether given number is prime
|
public static final int DEFAULT_MAX_NUM_IN_CACHE
public static final boolean CACHE_EMPTY
public static final boolean CACHING_FINISHED
public static final int IS_PRIME
public static final int IS_NOT_PRIME
public static final int NOT_IN_CACHE
public PrimesCache()
public PrimesCache(int maxNumInCache)
maxNumInCache
- Range of integers to be stored in prime cachepublic double getComputingTime()
public boolean getCacheStatus()
public int getNumberOfPrimes()
public int getMaxNumInCache()
public int primeTest(int n)
n
- Given integer number.