-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Wu Yujin] iP #155
base: master
Are you sure you want to change the base?
[Wu Yujin] iP #155
Conversation
* branch-Level-7: Add local storage for the tasks
* branch-Level-8: Change time field in Deadline and Event class to a LocalDate object Add content for data.txt Add data.txt # Conflicts: # src/main/java/Deadline.java # src/main/java/Duke.java # src/main/java/Event.java # src/main/java/Todo.java
* branch-Level-9: Add find function
* branch-A-JavaDo: Add Javadoc for some methods # Conflicts: # src/main/java/tasks/Task.java
* A-CodingStandard: Fix syntax error # Conflicts: # src/main/java/parser/Parser.java # src/main/java/ui/Ui.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I really like the fact that you have organised your code neatly into their respective packages.
That being said, I hope my suggestions (mostly touching on coding style) will be helpful to you 😄
src/main/java/Duke.java
Outdated
} | ||
|
||
/** | ||
* Run a Duke object while isExit is not changed to true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be Runs
instead of Run
?
import main.java.tasklist.*; | ||
import main.java.ui.*; | ||
import main.java.storage.*; | ||
import main.java.tasks.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could import each class that you would require explicitly instead of using wildcard imports?
return (type.equals(command.type))&&(description.equals(command.description)) | ||
&&(date == date||date.equals(command.date)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there could be spaces between each expression and its operator?
For example, line 43 could be changed to:
return (type.equals(command.type)) && (description.equals(command.description))
src/main/java/commands/Command.java
Outdated
import main.java.ui.Ui; | ||
|
||
/** | ||
* A command object containing information parsed from an Ui object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this line could start with * Contains information ...
?
import main.java.tasks.*; | ||
import main.java.tasklist.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could import each class that you would require explicitly instead of using wildcard imports?
src/main/java/tasks/Event.java
Outdated
} | ||
|
||
@Override | ||
public String data() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this could be renamed to getData()
?
src/main/java/tasks/Task.java
Outdated
protected boolean hasTime; | ||
protected static int numberOfTasks = 0; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this single line break could be removed?
src/main/java/tasks/Task.java
Outdated
* Reduce the count of tasks | ||
*/ | ||
public static void reduceOneTasks() { | ||
numberOfTasks--; | ||
} | ||
|
||
/** | ||
* Get the tick or cross sign which indicates is a task is complete | ||
* @return | ||
*/ | ||
public String getStatusIcon() { | ||
return (isDone ? "\u2713" : "\u2718"); //return tick or X symbols | ||
} | ||
|
||
public boolean getHasTime(){ | ||
return hasTime; | ||
} | ||
|
||
public LocalDate getTime(){ | ||
return null; | ||
} | ||
|
||
public String getDescription(){ | ||
return description; | ||
} | ||
|
||
|
||
/** | ||
* mark a task as finished | ||
* @return | ||
*/ | ||
public Task markAsDone() { | ||
this.isDone = true; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[" + getStatusIcon() + "] " + description; | ||
} | ||
|
||
/** | ||
* Return the message when a task is marked as done | ||
* @return mark-as-done Message | ||
*/ | ||
public String markAsDoneMessage() { | ||
return "Nice!(^∇^) I've marked this task as done:\n" | ||
+ this.toString().replace("\u2718", "\u2713"); | ||
} | ||
|
||
/** | ||
* Return the message when a new task is added | ||
*/ | ||
public String addMessage() { | ||
return "Got it.(^∇^) I've added this task:\n" | ||
+ this.toString(); | ||
} | ||
|
||
/** | ||
* Return the message when a task is deleted | ||
*/ | ||
public String deleteMessage() { | ||
return "Got it.(^∇^) I've deleted this task:\n" | ||
+ this.toString(); | ||
} | ||
|
||
/** | ||
* Return info about the task in the format for data storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a similar issue wrt Javadoc comment leading words in several other places.
src/main/java/ui/Ui.java
Outdated
* Show all the tasks that are still in the list | ||
* @param taskList | ||
*/ | ||
|
||
public void showTask(TaskList taskList) { | ||
if (taskList.getTasks().size() == 0) { | ||
System.out.println("This is no task in your task list yet. Add one now! (/^▽^)/"); | ||
} | ||
|
||
int no = 1; | ||
for (Task task : taskList.getTasks()) { | ||
String prefix = task.toString().substring(0, 7); | ||
String end = task.toString().substring(7); | ||
System.out.println(prefix + no + ". " + end); | ||
no++; | ||
} | ||
} | ||
|
||
/** | ||
* Show the tasks on certain day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a similar issue elsewhere regarding Javadoc comments.
src/test/java/parser/ParserTest.java
Outdated
@@ -0,0 +1,34 @@ | |||
package test.java.parser; | |||
|
|||
import main.java.commands.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a similar issue with import wildcards in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job overall! Can take note of the common styling issues such javadocs, whitespace before blocks and wildcard imports.
import main.java.tasklist.*; | ||
import main.java.ui.*; | ||
import main.java.storage.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to use .* imports.
src/main/java/storage/Storage.java
Outdated
String[] info = line.split(" \\| "); | ||
String type = info[0]; | ||
int complete = Integer.parseInt(info[1]); | ||
String title = info[2]; | ||
|
||
switch(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you can include a default case for switch statements.
src/main/java/ui/Ui.java
Outdated
@@ -55,7 +55,8 @@ public void displayErrorMessage(Exception ex){ | |||
* Show all the tasks that are still in the list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it should be "Shows all...". This is seen in the javadocs comments for other methods in this file and other files too.
public class FindCommand extends Command { | ||
private final String keyword; | ||
|
||
public FindCommand(String keyword){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be whitespace before '{'. This is seen in other block statements too.
* FXML: Complete ui Gradle function
Update code based on coding standard
* 'master' of https://github.com/SherryWu178/ip: Update code based on coding standard
* master: Update code based on coding standard # Conflicts: # src/main/java/duke/Duke.java # src/main/java/duke/parser/Parser.java # src/main/java/duke/ui/Ui.java
Add assertions
* 'master' of https://github.com/SherryWu178/ip: Add assertions
* branch-DoWithinPeriodTasks: Add PeriodTask class
No description provided.