-
Notifications
You must be signed in to change notification settings - Fork 438
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
[Cao] iP #466
Open
Ringo1225
wants to merge
70
commits into
nus-cs2103-AY2021S1:master
Choose a base branch
from
Ringo1225:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Cao] iP #466
Changes from 10 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
a0828cb
Added features for Greet, Echo and Exit
2a955ed
Added features of Level-2, Add and List
2960cdb
Added done feature, but not achieved
e6f5a1b
Add package main.java
d619ffa
Adjusted the robot's responding style
7a01956
Added a Task class, but did not merge it with the main class Duke.java
23ff51e
added printDescription() method to Task class
aaf0db0
Merged Task.java class with Duke.java class, completed features for l…
b989315
Added classes Todo, Deadline, Event.
46c1cf5
Added feature for Automated Text UI Testing
bf02861
Added feature for Exception handling
9ed888d
Handled exceptions for deadline
4630050
updated exceptions handling for event
eccd4bd
Finished delete function
518a798
Handled exception for Done
3d92ca2
Updated exception handling for delete operation
488eaec
Saved the list of tasks in a txt. file. Every time will load the data…
74ae682
solved the bug when the command.txt does not exist.
fc5812c
Stored Deadline data as java.time.LocalDate
fd6a9b3
Merge branch 'branch-Level-7'
9528c06
Merge branch 'branch-Level-8'
b6efb63
Revise the OOP of the project
Ringo1225 ecd9609
Add Junit test cases
Ringo1225 7dbaa04
add jar file on github
Ringo1225 ad53f61
Adds java docs
Ringo1225 2a51b71
Tweak the code to comply with a coding standard
Ringo1225 18690fd
Add find feature
Ringo1225 48642d3
Merge branch 'branch-A-JavaDoc'
Ringo1225 500c754
Merge branch 'branch-A-CodingStandard'
Ringo1225 4e5da11
Merge branch 'branch-Level-9'
Ringo1225 04d380f
Use Gradle to automate some of the build tasks of the project.
Ringo1225 da7df49
Merge branch 'branch-A-Gradle'
Ringo1225 e9dc761
Revise the project structure
Ringo1225 d743259
Revise project structure
Ringo1225 e9542b0
Edit build.gradle
Ringo1225 88955d9
Add some GUI feature
Ringo1225 64d7ccd
Improve GUI
Ringo1225 a2fe141
Restructure Parser
Ringo1225 03db3d5
fix bug for some operation
Ringo1225 6177d62
Merge branch 'master' into branch-GUI
Ringo1225 6ed168a
Finish GUI feature
Ringo1225 6703d18
Restructure project
Ringo1225 4867fea
Add FXML
Ringo1225 600c0da
Merge branch 'branch-GUI'
Ringo1225 31edbef
Try to create a jar file
Ringo1225 c24a998
Add assertions
Ringo1225 7dd194a
Improve code quality
Ringo1225 a99084c
Add feature: FixedDurationTasks
Ringo1225 3f9875b
Merge pull request #3 from Ringo1225/branch-A-Assertions
Ringo1225 2b5a07c
Merge branch 'master' of https://github.com/Ringo1225/ip
Ringo1225 4e15055
Merge branch 'master' into branch-A-CodeQuality
Ringo1225 ce96300
Merge branch 'branch-A-CodeQuality' into branch-B-FixedDurationTasks
Ringo1225 19baa19
Merge pull request #1 from Ringo1225/branch-A-CodeQuality
Ringo1225 25b7998
Merge branch 'master' of https://github.com/Ringo1225/ip
Ringo1225 1e4cdf2
Merge branch 'master' into branch-B-FixedDurationTasks
Ringo1225 1046b5e
Merge pull request #2 from Ringo1225/branch-B-FixedDurationTasks
Ringo1225 19b36fb
Merge branch 'master' of https://github.com/Ringo1225/ip
Ringo1225 cf73057
Add reuse acknowlegement
Ringo1225 4037756
Add Ui.png
Ringo1225 1655726
Update user guide
Ringo1225 4b7aeb1
Set theme jekyll-theme-minimal
Ringo1225 74aa3da
Revise user guide
Ringo1225 cbb962b
Merge branch 'master' of https://github.com/Ringo1225/ip
Ringo1225 3457ff4
Revise User Guide
Ringo1225 8e00007
Revise User Guide
Ringo1225 9a57b7a
Set theme jekyll-theme-midnight
Ringo1225 5513e6d
revise build.gradle, generate a jar file
Ringo1225 bd54f7a
Merge branch 'master' of https://github.com/Ringo1225/ip
Ringo1225 777b9e0
update jar file version
Ringo1225 1615411
Set theme jekyll-theme-minimal
Ringo1225 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package main.java; | ||
|
||
public class Deadline extends Task { | ||
protected String deadline; | ||
|
||
public Deadline(String description, String deadline) { | ||
super(description); | ||
this.deadline = deadline; | ||
} | ||
|
||
@Override | ||
public void printDescription() { | ||
System.out.println("[D][" + getStatusIcon() | ||
+ "] " + description + "(by:" + deadline + ")"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,103 @@ | ||
package main.java; | ||
|
||
import java.util.Scanner; | ||
import java.util.ArrayList; | ||
|
||
public class Duke { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
String logo = " ____ _ \n" | ||
+ "| _ \\ _ _| | _____ \n" | ||
+ "| _ \\ _ _| | _____\n" | ||
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Hello! I'm 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. different parts of the code can be grouped together as a method, make it easier for abstraction. |
||
System.out.println(" ____________________________________________________________\n"); | ||
|
||
ArrayList<Task> taskList = new ArrayList<Task>(); | ||
|
||
while (true) { | ||
String command = sc.next(); | ||
switch(command) { | ||
case "bye": | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Bye. Hope to see you again soon!"); | ||
System.out.println(" ____________________________________________________________\n"); | ||
return; | ||
case "list": | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Here are the tasks in your list:"); | ||
for (int i = 0; i < taskList.size(); i++) { | ||
System.out.print(" " + (i + 1) + "."); | ||
taskList.get(i).printDescription(); | ||
} | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
case "done": | ||
int index = sc.nextInt(); | ||
Task currentTask = taskList.get(index - 1); | ||
currentTask.markAsDone(); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Nice! I've marked this task as done:"); | ||
System.out.print(" "); | ||
currentTask.printDescription(); | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
case "todo": | ||
String todoDescription = sc.nextLine(); | ||
Todo todo = new Todo(todoDescription); | ||
taskList.add(todo); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Got it. I've added this task:"); | ||
System.out.print(" "); | ||
todo.printDescription(); | ||
System.out.println(" Now you have " + taskList.size() + " tasks in the list."); | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
case "deadline": | ||
String deadlineDescription = ""; | ||
while (!sc.hasNext("/by")) { | ||
deadlineDescription += sc.next(); | ||
deadlineDescription += " "; | ||
} | ||
sc.next("/by"); | ||
String time = sc.nextLine(); | ||
Deadline deadline = new Deadline(deadlineDescription, time); | ||
taskList.add(deadline); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Got it. I've added this task:"); | ||
System.out.print(" "); | ||
deadline.printDescription(); | ||
System.out.println(" Now you have " + taskList.size() + " tasks in the list."); | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
case "event": | ||
String eventDescription = ""; | ||
while (!sc.hasNext("/at")) { | ||
eventDescription += sc.next(); | ||
eventDescription += " "; | ||
} | ||
sc.next("/at"); | ||
String date = sc.nextLine(); | ||
Event event = new Event(eventDescription, date); | ||
taskList.add(event); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Got it. I've added this task:"); | ||
System.out.print(" "); | ||
event.printDescription(); | ||
System.out.println(" Now you have " + taskList.size() + " tasks in the list."); | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
default: | ||
String task = sc.nextLine(); | ||
taskList.add(new Task(command + task)); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" added: " + command + task); | ||
System.out.println(" ____________________________________________________________\n"); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package main.java; | ||
|
||
public class Event extends Task { | ||
protected String time; | ||
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. same suggestion as deadline |
||
|
||
public Event(String description, String time) { | ||
super(description); | ||
this.time = time; | ||
} | ||
|
||
@Override | ||
public void printDescription() { | ||
System.out.println("[E][" + getStatusIcon() | ||
+ "] " + description + "(at:" + time + ")"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main.java; | ||
|
||
public class Task { | ||
protected String description; | ||
protected boolean isDone; | ||
|
||
public Task(String description) { | ||
this.description = description; | ||
this.isDone = false; | ||
} | ||
|
||
public String getStatusIcon() { | ||
return (isDone ? "\u2713" : "\u2718"); | ||
} | ||
|
||
public void markAsDone() { | ||
this.isDone = true; | ||
} | ||
|
||
public void printDescription() { | ||
System.out.println("[" + getStatusIcon() + "] " + description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main.java; | ||
|
||
public class Todo extends Task { | ||
public Todo(String description) { | ||
super(description); | ||
} | ||
|
||
@Override | ||
public void printDescription() { | ||
System.out.println("[T][" + getStatusIcon() + "]" + description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,72 @@ | ||
Hello from | ||
____ _ | ||
| _ \ _ _| | _____ | ||
| _ \ _ _| | _____ | ||
| | | | | | | |/ / _ \ | ||
| |_| | |_| | < __/ | ||
|____/ \__,_|_|\_\___| | ||
|
||
____________________________________________________________ | ||
Hello! I'm Duke | ||
What can I do for you? | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Got it. I've added this task: | ||
[T][?] read book | ||
Now you have 1 tasks in the list. | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Got it. I've added this task: | ||
[D][?] return book (by: June 6th) | ||
Now you have 2 tasks in the list. | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Got it. I've added this task: | ||
[E][?] project meeting (at: Aug 6th 2-4pm) | ||
Now you have 3 tasks in the list. | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Nice! I've marked this task as done: | ||
[T][?] read book | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Here are the tasks in your list: | ||
1.[T][?] read book | ||
2.[D][?] return book (by: June 6th) | ||
3.[E][?] project meeting (at: Aug 6th 2-4pm) | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Nice! I've marked this task as done: | ||
[E][?] project meeting (at: Aug 6th 2-4pm) | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Here are the tasks in your list: | ||
1.[T][?] read book | ||
2.[D][?] return book (by: June 6th) | ||
3.[E][?] project meeting (at: Aug 6th 2-4pm) | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Got it. I've added this task: | ||
[T][?] buy bread | ||
Now you have 4 tasks in the list. | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Here are the tasks in your list: | ||
1.[T][?] read book | ||
2.[D][?] return book (by: June 6th) | ||
3.[E][?] project meeting (at: Aug 6th 2-4pm) | ||
4.[T][?] buy bread | ||
____________________________________________________________ | ||
|
||
____________________________________________________________ | ||
Bye. Hope to see you again soon! | ||
____________________________________________________________ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
todo read book | ||
|
||
deadline return book /by June 6th | ||
|
||
event project meeting /at Aug 6th 2-4pm | ||
|
||
done 1 | ||
|
||
list | ||
|
||
done 3 | ||
|
||
list | ||
|
||
todo buy bread | ||
|
||
list | ||
|
||
bye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Suggest using private keyword instead of protected.