Conversation
Ashertan256
left a comment
There was a problem hiding this comment.
Overall, the structure and flow of the code seems a little redundant at certain parts. But the format looks to be consistent with the course!
| public static void main(String[] args) { | ||
| greet(); | ||
|
|
||
| while (true) { |
There was a problem hiding this comment.
Instead of while(true), maybe you can consider using this instead:
do {
// code to run
}
while (!input.equal("bye"));
src/main/java/Elyk.java
Outdated
| public static void markTaskNotDone(int taskNum) { | ||
| taskList[taskNum - 1].markAsNotDone(); | ||
| System.out.println("OK, I've marked this task as not done yet:"); | ||
| System.out.println(" [ ] " + taskList[taskNum - 1].description); |
There was a problem hiding this comment.
Would using taskList[i].getStatusIcon (as you used below) be more consistent?
src/main/java/Elyk.java
Outdated
|
|
||
| public static void updateInput() { | ||
| input = command.nextLine(); | ||
| if (input.matches(".*\\d$")) { |
There was a problem hiding this comment.
A comment could be added to describe the regex pattern to be clearer
src/main/java/Elyk.java
Outdated
| if (input.matches(".*\\d$")) { | ||
| String[] words = input.split(" "); | ||
| input = words[0]; | ||
| taskNum = Integer.parseInt(words[1]); |
There was a problem hiding this comment.
This could potentially have issues if the second word is not a number. Attempting to parseInt a String may crash the program/cause an exception
src/main/java/Elyk.java
Outdated
| } | ||
|
|
||
| public static void markTaskNotDone(int taskNum) { | ||
| taskList[taskNum - 1].markAsNotDone(); |
There was a problem hiding this comment.
This seems like a redundant method, is it possible to call a single method without chaining multiple methods that do the same thing?
like input task type is not supported or there is missing information from the input
thomasjlalba
left a comment
There was a problem hiding this comment.
Good job thus far! Just some trivial suggestions to make it more readable and understandable for others.
src/main/java/Elyk.java
Outdated
| to = input.substring(toPos + 4); | ||
| from = input.substring(fromPos + 6, toPos - 1); | ||
| description = input.substring(6, fromPos - 1); |
There was a problem hiding this comment.
Maybe you can refactor the magic literals throughout your code to make it easier to understand
src/main/java/Elyk.java
Outdated
| from = input.substring(fromPos + 6, toPos - 1); | ||
| description = input.substring(6, fromPos - 1); | ||
| input = "event"; | ||
| } |
There was a problem hiding this comment.
Maybe you can include the final else statement for error detection
src/main/java/Elyk.java
Outdated
| public static void printTask() { | ||
| System.out.println("Here are the tasks in your list:"); | ||
| for (int i = 0; i < taskCounter; i++) { | ||
| System.out.println((i+1) + "." + taskList[i]); |
There was a problem hiding this comment.
Maybe you can standardise the use of spacing within your i+1 to make it more consistent (i + 1 instead)
src/main/java/Elyk.java
Outdated
| markTaskNotDone(taskNum); | ||
| break; | ||
| case "todo": | ||
| taskList[taskCounter++] = new Todo(description); |
There was a problem hiding this comment.
It might be more readable by separating the increment to the next line instead of combining it in the same line
src/main/java/Elyk.java
Outdated
| public static int taskCounter = 0; | ||
| public static int taskNum = 0; |
There was a problem hiding this comment.
The naming of these variables might suggest that they are the same. Maybe you can consider renaming them to make them clearer and more distinct.
src/main/java/Elyk.java
Outdated
| public static Scanner command = new Scanner(System.in); | ||
|
|
||
| public static void main(String[] args) { | ||
| greet(); |
There was a problem hiding this comment.
Good job on the abstraction of code to make it neater!
…ask into an abstract class
…ment of local variable
… created Ui and Parser class Modified code in Elyk and Storage to use TaskList instead
… in Elyk to work with them
…cording to keyword
Branch level 9
# Conflicts: # src/main/java/Ui.java
Branch a java doc
No description provided.