From f2703fb43f42ad1f7c401981251991669200418e Mon Sep 17 00:00:00 2001 From: dymik739 Date: Sat, 18 Mar 2023 11:42:01 +0200 Subject: [PATCH] code cleanup and minor bug fixes --- labs/2/Main.java | 13 ++----------- labs/2/src/help.txt | 5 ++++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/labs/2/Main.java b/labs/2/Main.java index c9de689..d113c1e 100644 --- a/labs/2/Main.java +++ b/labs/2/Main.java @@ -16,8 +16,7 @@ public class Main { boolean help_enqueued = false; boolean allow_networking = true; String matrix_file_name = ""; - int verbosity = 1; - + int p = 0; while (p < args.length) { try { @@ -25,10 +24,6 @@ public class Main { help_enqueued = true; p += 1; } - else if (Objects.equals(args[p], "-v")) { - verbosity = Integer.parseInt(args[p+1]); - p += 2; - } else if (Objects.equals(args[p], "--offline")) { allow_networking = false; p += 2; @@ -115,7 +110,7 @@ public class Main { Scanner help_file_scanner = new Scanner(help_file); while (help_file_scanner.hasNextLine()) { - System.out.print(help_file_scanner.nextLine()); + System.out.println(help_file_scanner.nextLine()); } help_file_scanner.close(); @@ -144,18 +139,14 @@ public class Main { int[][] baked_matrix = new int[baked_matrix_lines.size()][ref_length]; for (int i = 0; i < baked_matrix_lines.size(); i++) { - //for (String[] sa : baked_matrix_lines) { if (baked_matrix_lines.get(i).length != ref_length) { System.err.println("[ERROR] Matrix lines have different length! Assuming the matrix was corrupted"); System.exit(2); } for (int j = 0; j < baked_matrix_lines.get(i).length; j++) { - //System.out.print(baked_matrix_lines.get(i)[j] + " "); baked_matrix[i][j] = Integer.parseInt(baked_matrix_lines.get(i)[j]); } - - //System.out.print("\n"); } return baked_matrix; diff --git a/labs/2/src/help.txt b/labs/2/src/help.txt index 09ee4c3..c6f3d4b 100644 --- a/labs/2/src/help.txt +++ b/labs/2/src/help.txt @@ -1 +1,4 @@ -Dummy help file +Usage: java Main [options] [matrix_file] +Options: + -h Output this help text + --offline Prevent any possible attempt to fetch missing files from the server