Упрощен доступ к методам в классах Task и TodoApp, изменены модификаторы доступа с public на private для улучшения инкапсуляции. Это позволяет защитить внутреннюю логику классов от внешнего вмешательства и улучшает читаемость кода.

This commit is contained in:
2025-05-19 12:24:59 +03:00
parent 45c6e6e3d4
commit a4b250f10b
2 changed files with 10 additions and 10 deletions
@@ -13,7 +13,7 @@ public class TodoApp {
displayMainMenu();
}
public static int requestIntFromInput(String template, int[] allowedInts) {
private static int requestIntFromInput(String template, int[] allowedInts) {
do {
System.out.print(template);
int input;
@@ -35,7 +35,7 @@ public class TodoApp {
} while (true);
}
public static void displayMainMenu() {
private static void displayMainMenu() {
while (true) {
String menu = """
@@ -126,7 +126,7 @@ public class TodoApp {
}
public static Task getTaskById(int id) {
private static Task getTaskById(int id) {
for (int i = 0; i < tasksCounter; i++) {
if (tasks[i].getId() == id)
return tasks[i];
@@ -134,7 +134,7 @@ public class TodoApp {
return null;
}
public static void displayTask(Task task) {
private static void displayTask(Task task) {
task.printInfo(true);
String firstOption = task.getCompleted() ? "[1]Не выполнено" : "[1]Выполнено";
int input = requestIntFromInput(firstOption + " [0]Главное меню\n\nВвод:",