[Shen Jiaming] iP#105
Conversation
In build.gradle, the dependencies on distZip and/or distTar causes
the shadowJar task to generate a second JAR file for which the
mainClass.set("seedu.duke.Duke") does not take effect.
Hence, this additional JAR file cannot be run.
For this product, there is no need to generate a second JAR file
to begin with.
Let's remove this dependency from the build.gradle to prevent the
shadowJar task from generating the extra JAR file.
Added Task Class
| String logo = " ____ ____ ____ _ _\n" | ||
| + " | _ \\ | _\\ / __ \\ | \\ | |\n" | ||
| + " | |_) | | |_) | | | | | | \\ | | \n" | ||
| + " | _ < | ___/ | | | | | |\\\\ | |\n" | ||
| + " | |_) | | | \\ \\ | |__| | | | \\\\| |\n" | ||
| + " |____/ |_| \\_\\ \\____/ |_| \\__|\n"; |
There was a problem hiding this comment.
Should this be a static variable?
There was a problem hiding this comment.
Should logo be capitalised as LOGO instead to follow the naming convention for constants?
| + " | |_) | | | \\ \\ | |__| | | | \\\\| |\n" | ||
| + " |____/ |_| \\_\\ \\____/ |_| \\__|\n"; | ||
| Scanner input = new Scanner(System.in); | ||
| System.out.println(logo + "Hello! I'm Bron\n" + "What can I do for you?\n"); |
There was a problem hiding this comment.
You may change your name into a variable for easier reuse & modification (if any)
| if (line.equalsIgnoreCase("bye")) { | ||
| System.out.println("Catch you on the flip cuh"); | ||
| break; | ||
| } | ||
|
|
||
| if (line.equalsIgnoreCase("list")) { | ||
| int listCount = 0; | ||
| while(tasks[listCount] != null) { | ||
| System.out.println(listCount + 1 + ". " + tasks[listCount++].printTask()); | ||
| } | ||
| } else if (line.startsWith("mark")){ | ||
| int taskIndex = Integer.parseInt(line.split(" ")[1]) - 1; | ||
| if (taskIndex >= 0 && taskIndex < taskCount) { | ||
| tasks[taskIndex].markAsDone(); | ||
| System.out.println("Good shit kid! I've marked this task as done:"); | ||
| System.out.println(" " + tasks[taskIndex].printTask()); | ||
| } else { | ||
| System.out.println("Task not found."); | ||
| } | ||
| } else if (line.startsWith("unmark")) { | ||
| int taskIndex = Integer.parseInt(line.split(" ")[1]) - 1; | ||
| if (taskIndex >= 0 && taskIndex < taskCount) { | ||
| tasks[taskIndex].markAsNotDone(); | ||
| System.out.println("Get yo shit together son, this task aint done yet:"); | ||
| System.out.println(" " + tasks[taskIndex].printTask()); | ||
| } else { | ||
| System.out.println("Task not found."); | ||
| } | ||
| } else { | ||
| System.out.println("added" + ": " + line); | ||
| tasks[taskCount++] = new Task(line); | ||
| } |
There was a problem hiding this comment.
You may separate the process of each command into methods for readability and reusability.
Should the command words (ex: "mark", "list", ...) be static variables?
| public String printTask() { | ||
| return "[" + getStatusIcon() + "] " + this.description; | ||
| } |
There was a problem hiding this comment.
As the method is returning a String, not printing it out, should its name be changed to getTaskString() or something like that?
| String logo = " ____ ____ ____ _ _\n" | ||
| + " | _ \\ | _\\ / __ \\ | \\ | |\n" | ||
| + " | |_) | | |_) | | | | | | \\ | | \n" | ||
| + " | _ < | ___/ | | | | | |\\\\ | |\n" | ||
| + " | |_) | | | \\ \\ | |__| | | | \\\\| |\n" | ||
| + " |____/ |_| \\_\\ \\____/ |_| \\__|\n"; |
There was a problem hiding this comment.
Should logo be capitalised as LOGO instead to follow the naming convention for constants?
| Task[] tasks = new Task[100]; | ||
| int taskCount = 0; | ||
|
|
||
| while (true) { |
There was a problem hiding this comment.
Should the main function be shortened (eg. with more abstraction)? This main function is quite hard to read for me as it is quite long.
There was a problem hiding this comment.
Should there be something in this file to prevent people from being mislead, or at least, a TODO in this file to understand what needs to be done?
| while(tasks[listCount] != null) { | ||
| System.out.println(listCount + 1 + ". " + tasks[listCount++].printTask()); | ||
| } | ||
| } else if (line.startsWith("mark")){ |
There was a problem hiding this comment.
This looks like arrowhead code, and I feel with more abstraction we could reduce this effect
…s for adding Todo, deadline and event
Created Command enum, CommandHandler class and ChatBotManager class to improve readability and organization of code
Added new Exception classes and updated error handling mechanism in CommandHandler
This reverts commit 03196e6.
Added new Exception classes and updated error handling mechanism in CommandHandler
| } | ||
|
|
||
| private static Task[] initializeTasks() { | ||
| return new Task[100]; |
Implemented reading of data from hard drive upon chatbot launch
Branch level 8
Branch level 9
No description provided.