feat(search): add occurrence counting menu and student settings

- add occurrence counting menu using StudentOccurrenceIndexFinder
- add student settings window for configuring search target
- display occurrence count and matching indices
- update current collection menu to delegate occurrence counting
This commit is contained in:
2026-09-01 17:13:48 +04:00
parent 84f9e2aa8d
commit 259e0bc8bd
3 changed files with 285 additions and 10 deletions
@@ -4,6 +4,7 @@ import com.googlecode.lanterna.gui2.ActionListBox;
import com.googlecode.lanterna.gui2.WindowBasedTextGUI;
import ru.project.model.AppState;
import ru.project.ui.base.BaseModalWindow;
import ru.project.ui.collection.counting.CountOccurrencesMenu;
import ru.project.ui.collection.search.SearchCollectionMenu;
import ru.project.ui.collection.sorting.SortCollectionMenu;
import ru.project.ui.common.CollectionDisplayWindow;
@@ -15,8 +16,7 @@ public class CurrentCollectionMenu extends BaseModalWindow {
private final SortCollectionMenu sortCollectionMenu;
private final SearchCollectionMenu searchCollectionMenu;
// private final CountOccurrencesMenu countOccurrencesMenu;
private final CountOccurrencesMenu countOccurrencesMenu;
public CurrentCollectionMenu(WindowBasedTextGUI gui, AppState state) {
@@ -28,7 +28,7 @@ public class CurrentCollectionMenu extends BaseModalWindow {
this.searchCollectionMenu = new SearchCollectionMenu(gui, state);
// this.countCollectionMenu = new CountOccurrencesMenu(gui, state);
this.countOccurrencesMenu = new CountOccurrencesMenu(gui, state);
ActionListBox menu = new ActionListBox();
menu.addItem("Показать коллекцию...", this::showCurrentCollection);
@@ -39,7 +39,7 @@ public class CurrentCollectionMenu extends BaseModalWindow {
menu.addItem("Меню поиска элемента в коллекции", searchCollectionMenu::showModal);
menu.addItem("Меню подсчёта количества вхождений элемента", this::countOccurrences);
menu.addItem("Меню подсчёта количества вхождений элемента", countOccurrencesMenu::showModal);
menu.addItem("Выйти", this::close);
@@ -57,10 +57,4 @@ public class CurrentCollectionMenu extends BaseModalWindow {
window.showModal();
}
private void countOccurrences() {
// CountOccurrencesMenu countOccurrencesMenu = new CountOccurrencesMenu(gui, state);
//
// countOccurrencesMenu.showModal();
}
}