17 |
* Free Software Foundation, Inc., * |
* Free Software Foundation, Inc., * |
18 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 |
***************************************************************************/ |
***************************************************************************/ |
20 |
#include "solutionhash.h" |
#include "containerhash.h" |
21 |
|
|
22 |
SolutionHash::SolutionHash(GUIUpdate* update) |
ContainerHash::ContainerHash(GUIUpdate* update) |
23 |
: SolutionContainer(update) |
: SolutionContainer(update) |
24 |
{ |
{ |
25 |
total = -1; |
total = -1; |
31 |
} |
} |
32 |
|
|
33 |
|
|
34 |
SolutionHash::~SolutionHash() |
ContainerHash::~ContainerHash() |
35 |
{ |
{ |
36 |
} |
} |
37 |
|
|
38 |
int SolutionHash::numSolutions() |
int ContainerHash::numSolutions() |
39 |
{ |
{ |
40 |
int size = 0; |
int size = 0; |
41 |
for (int i=0; i<m_hashroof; i++) { |
for (int i=0; i<m_hashroof; i++) { |
44 |
return size; |
return size; |
45 |
} |
} |
46 |
|
|
47 |
int SolutionHash::totalSolutions() |
int ContainerHash::totalSolutions() |
48 |
{ |
{ |
49 |
return total; |
return total; |
50 |
} |
} |
51 |
|
|
52 |
|
|
53 |
void SolutionHash::uniqueSolutions() |
void ContainerHash::uniqueSolutions() |
54 |
{ |
{ |
55 |
while (m_hashroof >1 ) { |
while (m_hashroof >1 ) { |
56 |
for (int bucket=0; bucket < m_hashroof; bucket++) { |
for (int bucket=0; bucket < m_hashroof; bucket++) { |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
void SolutionHash::uniqueSolutionsWorker(int bucket, int rot,bool mirror) |
void ContainerHash::uniqueSolutionsWorker(int bucket, int rot,bool mirror) |
92 |
{ |
{ |
93 |
int match_count; |
int match_count; |
94 |
|
|
121 |
|
|
122 |
|
|
123 |
/* BACKUP |
/* BACKUP |
124 |
void SolutionHash::uniqueSolutionsWorker(int rot,bool mirror) |
void ContainerHash::uniqueSolutionsWorker(int rot,bool mirror) |
125 |
{ |
{ |
126 |
int match_count; |
int match_count; |
127 |
|
|
150 |
} |
} |
151 |
*/ |
*/ |
152 |
|
|
153 |
void SolutionHash::addSolution(Solution* sol) |
void ContainerHash::addSolution(Solution* sol) |
154 |
{ |
{ |
155 |
int hash = m_size % max_size; |
int hash = m_size % max_size; |
156 |
solutions[hash]->push_back(sol); |
solutions[hash]->push_back(sol); |
157 |
m_size++; |
m_size++; |
158 |
} |
} |
159 |
|
|
160 |
Solution* SolutionHash::solution(int index) |
Solution* ContainerHash::solution(int index) |
161 |
{ |
{ |
162 |
int count=0; |
int count=0; |
163 |
ListIt it; |
ListIt it; |