Aleph-w  1.5a.2
Biblioteca general de algoritmos y estructuras de datos
 Todo Clases Archivos Funciones Variables 'typedefs' Enumeraciones Amigas Grupos Páginas
genHashTable.H
1 
2 # ifndef GENHASHTABLE_H
3 # define GENHASHTABLE_H
4 
5 
16 {
17 
18 protected:
19 
20  GenHashTable() { /* Empty */ }
21 
22 public:
23 
25  static const unsigned int numPrimes = 28;
26 
28  static const unsigned long primeList[];
29 
31  static const unsigned int DefaultIndex = 0;
32 
34  static const unsigned long DefaultPrime; // primeList[DefaultIndex]
35 
44  static int nextPrimeIndex(unsigned long n)
45  {
46  unsigned int i;
47 
48  for (i = 0; i < numPrimes; i++)
49  if (primeList[i] > n)
50  return i;
51  return -1;
52  }
53 
63  static int prevPrimeIndex(unsigned long n)
64  {
65  unsigned int i;
66 
67  for (i = 1; i < numPrimes; i++)
68  if (primeList[i] > n)
69  return i - 1;
70 
71  return -1;
72  }
73 
74 
75 }; /* GenHashTable */
76 
77 
78 
79 # endif /* GENHASHTABLE_H */
static const unsigned int DefaultIndex
Default index in primeList array.
Definition: genHashTable.H:31
static const unsigned int numPrimes
Number of primes saved in primeList array.
Definition: genHashTable.H:25
static const unsigned long DefaultPrime
Default prime number (this is primeList[DefaultIndex])
Definition: genHashTable.H:34
Definition: genHashTable.H:15
static const unsigned long primeList[]
Array of prime numbers.
Definition: genHashTable.H:28
static int prevPrimeIndex(unsigned long n)
Definition: genHashTable.H:63
static int nextPrimeIndex(unsigned long n)
Definition: genHashTable.H:44

Leandro Rabindranath León