-
Notifications
You must be signed in to change notification settings - Fork 83
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
[Wang-Jingwei] iP #102
base: master
Are you sure you want to change the base?
[Wang-Jingwei] iP #102
Conversation
This reverts commit f44a3e6.
This reverts commit 748b623.
* branch-Level-5: Add some error handlings.
This reverts commit 4d255af.
* branch-Level-6: Add the delete functionality.
* branch-Level-7: Add the functionality to load data from the file and save data into the file.
Add the find functionality.
* 'master' of https://github.com/Wang-Jingwei/ip: Add the find functionality.
* master: Add the find functionality.
Branch a java doc
* 'master' of https://github.com/Wang-Jingwei/ip: Add javaDoc.
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.
Readable code with some coding standard and naming convention issue.
public void run() throws IOException { | ||
String task; | ||
ui.greetings(); | ||
Scanner in = new Scanner(System.in); |
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 you should consider a more descriptive name for the Scanner object like "scanner"?
String task; | ||
ui.greetings(); | ||
Scanner in = new Scanner(System.in); | ||
task=in.nextLine(); |
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.
Please make sure the spaces between operators are consistent.
else{ | ||
try{ | ||
int index = Integer.parseInt(words[1]); | ||
if(index>todolist.size()||index<=0) System.out.println("No task found."); |
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 you should consider having the if block in two lines.
break; | ||
} | ||
case "find": { | ||
if (words.length == 1) ui.incompleteMessage("find"); |
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 you could place the if and else blocks in more than a line.
*/ | ||
|
||
public static void save(String textToAdd,String filePath) throws IOException { | ||
FileWriter fw = new FileWriter(filePath,false); |
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 you should consider a more descriptive name for the object like fileWriter.
*/ | ||
public ArrayList<Task> load() throws IOException { | ||
ArrayList<Task> todolist = new ArrayList<Task>(); | ||
BufferedReader br = new BufferedReader(new FileReader(this.filePath)); |
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.
Name like "bufferedReader" would be better in this case.
* @param deadline Description of the task which will be added as Deadline. | ||
*/ | ||
public void addDeadline(ArrayList<Task> taskList, String deadline){ | ||
String[] deadline1 = deadline.split("/by", 2); |
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 you should use the plural form for the name of a String array.
No description provided.