feat: make bucket-finder default

This commit is contained in:
Michael Mandl 2024-03-21 20:57:02 +01:00
parent 06500fd69a
commit 8c9a1522a0
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7

View file

@ -28,12 +28,12 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow() { delete ui; } MainWindow::~MainWindow() { delete ui; }
void MainWindow::setupAlgorithmSelector() { void MainWindow::setupAlgorithmSelector() {
search_algorithms_.appendRow(new QStandardItem("Bucket search"));
search_algorithms_.appendRow(new QStandardItem("Linear search")); search_algorithms_.appendRow(new QStandardItem("Linear search"));
search_algorithms_.appendRow(new QStandardItem("Sorted linear search")); search_algorithms_.appendRow(new QStandardItem("Sorted linear search"));
search_algorithms_.appendRow(new QStandardItem("Parallel search")); search_algorithms_.appendRow(new QStandardItem("Parallel search"));
search_algorithms_.appendRow(new QStandardItem("Tree search")); search_algorithms_.appendRow(new QStandardItem("Tree search"));
search_algorithms_.appendRow(new QStandardItem("Grouped search")); search_algorithms_.appendRow(new QStandardItem("Grouped search"));
search_algorithms_.appendRow(new QStandardItem("Bucket search"));
} }
void MainWindow::setupWordListSourceSelector() { void MainWindow::setupWordListSourceSelector() {
@ -89,8 +89,8 @@ void MainWindow::search(const QString &search_term) {
timer.stop(); timer.stop();
std::stringstream status_message; std::stringstream status_message;
status_message << "search took " << timer << ", found " status_message << "search took " << timer << ", found " << results.size()
<< std::distance(results.begin(), results.end()) << " results"; << " result(s) in " << word_list_.size() << " words.";
ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str())); ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str()));
showResults(results); showResults(results);
@ -102,22 +102,22 @@ void MainWindow::createSelectedFinder() {
switch (selectedFinder) { switch (selectedFinder) {
case 0: case 0:
default: default:
finder_ = std::make_unique<LinearFinder>(word_list_); finder_ = std::make_unique<BucketFinder>(word_list_);
break; break;
case 1: case 1:
finder_ = std::make_unique<SortedLinearFinder>(word_list_); finder_ = std::make_unique<LinearFinder>(word_list_);
break; break;
case 2: case 2:
finder_ = std::make_unique<ParallelFinder>(word_list_); finder_ = std::make_unique<SortedLinearFinder>(word_list_);
break; break;
case 3: case 3:
finder_ = std::make_unique<TreeFinder>(word_list_); finder_ = std::make_unique<ParallelFinder>(word_list_);
break; break;
case 4: case 4:
finder_ = std::make_unique<GroupedFinder>(word_list_); finder_ = std::make_unique<TreeFinder>(word_list_);
break; break;
case 5: case 5:
finder_ = std::make_unique<BucketFinder>(word_list_); finder_ = std::make_unique<GroupedFinder>(word_list_);
break; break;
} }
} }