Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<groupId>sorting.algorithm.visualization</groupId>
<artifactId>sav</artifactId>
<version>1.0</version>
<version>1.2</version>
<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
52 changes: 34 additions & 18 deletions src/main/java/ui/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/ui/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static void clearArrayAndFillRandomly(ArrayList<Integer> 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);
}
}

Expand Down