/[projects]/queensgui/src/solutionhash.cpp
ViewVC logotype

Diff of /queensgui/src/solutionhash.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by torben, Thu Jul 19 22:26:42 2007 UTC revision 3 by torben, Thu Jul 19 23:36:33 2007 UTC
# Line 17  Line 17 
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;
# Line 31  SolutionHash::SolutionHash(GUIUpdate* up Line 31  SolutionHash::SolutionHash(GUIUpdate* up
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++) {
# Line 44  int SolutionHash::numSolutions() Line 44  int SolutionHash::numSolutions()
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++) {
# Line 88  void SolutionHash::uniqueSolutions() Line 88  void SolutionHash::uniqueSolutions()
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    
# Line 121  void SolutionHash::uniqueSolutionsWorker Line 121  void SolutionHash::uniqueSolutionsWorker
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    
# Line 150  void SolutionHash::uniqueSolutionsWorker Line 150  void SolutionHash::uniqueSolutionsWorker
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;

Legend:
Removed from v.2  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.20