From 8435b69f0c81603180c1f313ae8879315499f2ed Mon Sep 17 00:00:00 2001 From: bruch-alex Date: Thu, 17 Oct 2024 16:30:26 +0200 Subject: [PATCH 1/2] change minimal jdk to 11 --- .idea/misc.xml | 2 +- pom.xml | 6 ++--- src/main/java/ui/Menu.java | 52 ++++++++++++++++++++++++------------- src/main/java/ui/Utils.java | 2 +- 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index f346f33..d24ea8e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index fbad8cc..e6721d8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,10 +6,10 @@ sorting.algorithm.visualization sav - 1.0 + 1.2 - 22 - 22 + 11 + 11 UTF-8 diff --git a/src/main/java/ui/Menu.java b/src/main/java/ui/Menu.java index 94499f8..ce6da21 100644 --- a/src/main/java/ui/Menu.java +++ b/src/main/java/ui/Menu.java @@ -8,28 +8,44 @@ class Menu { protected static void printOptions() { JTerminal.clear(); Utils.printInCenter("AWESOME algorithm visualization app", "="); - JTerminal.println(""" - \nSelect an option:\ - \n\ - \n(1)\tRun Bubble Sort\ - \n(2)\tRun Insertion Sort\ - \n(3)\tRun Quick Sort\ - \n(4)\tRun Selection Sort\ - \n(5)\tHeap Sort - \n(a)\tRun all\ - \n(e)\texit"""); + System.out.println("Select an option" + + "\n" + + "(1)\tRun Bubble Sort" + + "\n(2)\tRun Insertion Sort" + + "\n(3)\tRun Quick Sort" + + "\n(4)\tRun Selection Sort" + + "\n(5)\tHeap Sort" + + "\n(a)\tRun all" + + "\n(e)\texit"); } protected static void handleOptions() { switch (reader.readLine().trim().toLowerCase()) { - case "1" -> BubbleSort.start(); - case "2" -> InsertionSort.start(); - case "3" -> QuickSort.start(); - case "4" -> SelectionSort.start(); - case "5" -> HeapSort.start(); - case "a", "all" -> StartAllOption.start(); - case "exit", "e" -> System.exit(0); - default -> JTerminal.println("Wrong input"); + case "1": + BubbleSort.start(); + break; + case "2": + InsertionSort.start(); + break; + case "3": + QuickSort.start(); + break; + case "4": + SelectionSort.start(); + break; + case "5": + HeapSort.start(); + break; + case "a": + case "all": + StartAllOption.start(); + break; + case "exit": + case "e": + System.exit(0); + default: + JTerminal.println("Wrong input"); + break; } } } diff --git a/src/main/java/ui/Utils.java b/src/main/java/ui/Utils.java index ff7080e..9f0649a 100644 --- a/src/main/java/ui/Utils.java +++ b/src/main/java/ui/Utils.java @@ -101,7 +101,7 @@ public static void clearArrayAndFillRandomly(ArrayList array, int width Random r = new Random(); array.clear(); for (int i = 0; i < width - 1; i++) { - array.add(r.nextInt(1, (int) (height - 1))); + array.add(r.nextInt(height - 1) + 1); } } From 9da58e5b4d54d00cd8fe7d95c234a8f6aa355df8 Mon Sep 17 00:00:00 2001 From: Alex Bruch Date: Thu, 17 Oct 2024 17:02:15 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e2824fb..488a17d 100644 --- a/README.md +++ b/README.md @@ -94,5 +94,5 @@ This command will create `/taget` folder and executable `sav-version-jar-with-de 2. Open terminal in a folder where the `.jar` file is located. Run this command to start the program: ``` -java -jar sav-1.0-jar-with-dependencies.jar +java -jar sav-1.2-jar-with-dependencies.jar ```