-
Notifications
You must be signed in to change notification settings - Fork 454
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
[Rebecca Lau] iP #476
base: master
Are you sure you want to change the base?
[Rebecca Lau] iP #476
Changes from 1 commit
d839859
dce5cee
247ac39
78ea29d
f15709b
6a5d0e8
0be4686
5cb8123
0c57b93
310178c
1cbdef7
fd0bb3d
2ae58cc
2fcd257
f2aedc3
e6a51b1
fe0ff94
e4ad385
8e90406
c27673f
7fb685b
cb8b508
e48c0b5
b4758be
f14f614
db642c7
80db064
621657a
07cb01c
87995c8
db907f2
9cf988a
c6cc3a3
0972eb4
a4dd0df
cc9a2e4
2f301dd
20a4b9e
b77329f
c053484
2ef64a7
f29ff73
35b27e9
86cd0e0
9931a27
2e44079
fcab3b7
764206d
7f34564
9dcab1a
308fc97
454e98a
1bb04c1
1e77943
da29a26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
T | 1 | read book | ||
D | 0 | return book | June 6th | ||
E | 0 | project meeting | Aug 6th 2-4pm | ||
T | 1 | join sports club | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
package duke; | ||
|
||
import duke.command.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it better to not use wildcard for the import? It might be better to list all the stuff you want to import. |
||
|
||
public class Parser { | ||
public static Command parse(String input) throws DukeException { | ||
if (input.equals("bye")) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
package duke; | ||
|
||
import duke.task.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be better to specifically list imports as before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to list all the stuff you want to import instead of using wildcard. |
||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.util.ArrayList; | ||
import java.util.Scanner; | ||
|
||
public class Storage { | ||
|
@@ -32,12 +35,12 @@ public void rewriteFile(TaskList ls) { | |
String desc = task.getDesc(); | ||
String addOns = task.addOns(); | ||
if (type == "todo") { | ||
writer.println("T" + (task.isDone ? " | 1 | " : " | 0 | ") + desc); | ||
writer.println("T" + (task.checkIfDone() ? " | 1 | " : " | 0 | ") + desc); | ||
} else if (type == "deadline") { | ||
writer.println("D" + (ls.getTask(i).isDone ? " | 1 | " : " | 0 | ") | ||
writer.println("D" + (ls.getTask(i).checkIfDone() ? " | 1 | " : " | 0 | ") | ||
+ desc + " | " + addOns); | ||
} else if (type == "event") { | ||
writer.println("E" + (task.isDone ? " | 1 | " : " | 0 | ") | ||
writer.println("E" + (task.checkIfDone() ? " | 1 | " : " | 0 | ") | ||
+ desc + " | " + addOns); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package duke; | ||
|
||
import duke.task.Task; | ||
import duke.task.TaskList; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Ui { | ||
|
@@ -15,7 +20,7 @@ public void showWelcome() { | |
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
System.out.println("Hello! I'm Duke\n" + "What can I do for you?"); | ||
System.out.println("Hello! I'm duke.Duke\n" + "What can I do for you?"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may import the duke package inside, and you not really have to specify package all the time. |
||
} | ||
|
||
public void goodbye() { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,9 @@ | ||||||||||
package duke.command; | ||||||||||
import duke.task.TaskList; | ||||||||||
import duke.Ui; | ||||||||||
import duke.Storage; | ||||||||||
import duke.DukeException; | ||||||||||
|
||||||||||
public abstract class Command { | ||||||||||
public abstract void execute(TaskList ls, Ui ui, Storage storage) throws DukeException; | ||||||||||
public abstract boolean isExit(); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since all but one of the commands have
Suggested change
|
||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package duke.task; | ||
import duke.DukeException; | ||
|
||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
import java.time.format.DateTimeParseException; | ||
|
@@ -14,7 +17,7 @@ public Deadline(String description, String deadline) throws DukeException { | |
LocalDate localDate = LocalDate.parse(deadline); | ||
this.date = localDate.format(DateTimeFormatter.ofPattern("MMM dd yyyy")); | ||
} catch (DateTimeParseException e) { | ||
throw new DukeException("Deadline should be in a yyyy-mm-dd format."); | ||
throw new DukeException("duke.task.Deadline should be in a yyyy-mm-dd format."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may import duke.task here. |
||
} | ||
|
||
if (description.isEmpty() || description == "" || description == " ") { | ||
|
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.
Would be better to specifically list all
duke.command
imports here instead of using wildcard imports