forked from se-edu/duke
-
Notifications
You must be signed in to change notification settings - Fork 73
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
[Lam Yue Wei] iP #57
Open
lamyuewei
wants to merge
55
commits into
nus-cs2113-AY1920S2:master
Choose a base branch
from
lamyuewei: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
[Lam Yue Wei] iP #57
Changes from 7 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
fcd317b
Completed Level 0 (Greet)
lamyuewei 59307c5
Completed Level 1. Greet, Echo, Exit
lamyuewei 5895960
Completed Level 2. Add, List
lamyuewei ce2126e
Completed Level 3. Mark as Done
lamyuewei dd30a60
Completed Extension of Level 3: A-Classes
lamyuewei 19ae450
Completed tweaking the code to comply with a coding standard (A-Codin…
lamyuewei 87cd5ff
Completed Level-4: ToDo, Event, Deadline
lamyuewei cc313b9
Completed A-TextUiTesting: Automated Text UI Testing
lamyuewei 5baf6ea
A-CodeQuality: Improve Code Quality through refracting codes as well …
lamyuewei a9bead2
Refracted case list, done & bye into methods. Added Exceptions for li…
lamyuewei 8e9ad00
Completed A-Exceptions. Refracted and added exception for todo, deadl…
lamyuewei 45fee0f
Minimum editing to Task's getStatusIcon to make use of getter rather …
lamyuewei d7d84c2
Merge branch 'branch-Level-5'
lamyuewei d4b3fdc
Completed A-Packages: Organize into Packages
lamyuewei c38ed01
Updated input, actual and expected files to make testing more vigorou…
lamyuewei c159fbd
Merge branch 'branch-A-Packages'
lamyuewei d972c31
Commit manifest file for A-Jar
lamyuewei 47b8924
Add delete method for level 6 and update test cases
lamyuewei 9ed4570
Complete Level 7 Save Method
lamyuewei 62e11ce
Merge branch 'branch-Level-6'
lamyuewei 29f37cc
Merge branch 'branch-Level-7', Resolve Merge Conflict
lamyuewei d382133
Replace Symbols(Tick, Cross, Smiley Face) with Words
lamyuewei 26b1ef0
Complete Level 9 Find, Modify runtest.bat to delete duke.txt in text-…
lamyuewei c367324
Merge pull request #2 from lamyuewei/branch-Level-9
lamyuewei dfd0064
Complete A-JavaDoc and Add JavaDoc comments
lamyuewei c03d3ab
Resolve merge conflict of branch 'master' into branch-A-JavaDoc
lamyuewei ecc5cff
Merge pull request #4 from lamyuewei/branch-A-JavaDoc
lamyuewei c11bc5e
Complete Level 8. Dates and Times for deadline and event
lamyuewei d9fdaf4
Resolve Merge Conflict of branch 'master' into branch-Level-8
lamyuewei 8397876
Merge pull request #5 from lamyuewei/branch-Level-8
lamyuewei c150c23
Commit changes post Level 8
lamyuewei 8d1b6bb
Edit Duke File
lamyuewei ed501e8
Merge branch 'master' of https://github.com/lamyuewei/duke
lamyuewei 9db50ad
Set theme jekyll-theme-cayman
lamyuewei 40c9d1c
Complete A-UserGuide: User Guide
lamyuewei 6403971
Rectify issue of editing on the Wrong README earlier
lamyuewei 8b2079c
Bug fixed to rmake word bold instead of showing #
lamyuewei 0d43e60
Bug Fixed for README next line
lamyuewei 1794379
Bug Fix for Summary of Content in README
lamyuewei a50358e
Bug fix v2 for Summary of Command in README
lamyuewei d434479
Bug fix v3 for Summary of Comand in README
lamyuewei 3d47646
Bug Fixed Typo in README
lamyuewei 8946f00
Add help command
lamyuewei 2e37685
Add Storage and Ui class
lamyuewei 03d714a
Add emphasize on keywords in README
lamyuewei fc66763
Add Parser and TaskList
lamyuewei f2cfdda
Add Command, HelpCommand, ListCommand
lamyuewei 9fee2e4
Extract list and help into parser
lamyuewei 0153e1f
Add DukeException and DukeDateTimeException
lamyuewei df59569
Add DoneCommand and FindCommand
lamyuewei b2c9113
Add DeleteCommand
lamyuewei 245182d
Complete all extraction into Command and Parser
lamyuewei 2ce54f1
Minor edit on javadoc
lamyuewei 5df548e
Bug Fix on Storage, add exception in Parser
lamyuewei c182a6a
Package Storage, Ui, Parser, Constant, TaskList Object
lamyuewei 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,11 @@ | ||
public class Deadline extends Task { | ||
String date; | ||
public Deadline(String description, String date) { | ||
super(description); | ||
this.date = date; | ||
} | ||
|
||
public String toString() { | ||
return "[D]" + super.toString() + " (by: " + this.date + ")"; | ||
} | ||
} |
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,73 @@ | ||
import java.util.Scanner; | ||
import java.util.Arrays; | ||
|
||
public class Duke { | ||
public static void main(String[] args) { | ||
String logo = " ____ _ \n" | ||
+ "| _ \\ _ _| | _____ \n" | ||
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
Task[] tasks = new Task[100]; | ||
int count = 0; | ||
boolean isBye = false; | ||
System.out.println(" ____________________________________________________________"); | ||
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. Maybe we can apply refactoring to the greeting function. |
||
System.out.println(" Hello! I'm Duke"); | ||
System.out.println(" What can I do for you?"); | ||
System.out.println(" ____________________________________________________________"); | ||
Scanner sc = new Scanner(System.in); | ||
while (!isBye) { | ||
String description; | ||
String date; | ||
System.out.println(); | ||
String string = sc.nextLine(); | ||
System.out.println(" ____________________________________________________________"); | ||
String[] stringSplit = string.split(" "); | ||
switch (stringSplit[0]) { | ||
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. Use switch to deal with different types of commands is more clear than my method. Nice! |
||
case "list": | ||
System.out.println(" Here are the tasks in your list:"); | ||
for (int i = 0; i < count; i++) { | ||
System.out.println(" " + (i + 1) + "." + tasks[i].toString()); | ||
} | ||
break; | ||
case "done": | ||
int done = Integer.parseInt(stringSplit[1]) - 1; | ||
tasks[done].markAsDone(); | ||
System.out.println(" Nice! I've marked this task as done: "); | ||
System.out.println(" " + tasks[done].toString()); | ||
break; | ||
case "bye": | ||
System.out.println(" Bye. Hope to see you again soon!"); | ||
isBye = true; | ||
break; | ||
case "todo": | ||
description = String.join(" ", Arrays.copyOfRange(stringSplit, 1, stringSplit.length)); | ||
tasks[count] = new Todo(description); | ||
System.out.println(" Got it. I've added this task: "); | ||
System.out.println(" " + tasks[count].toString()); | ||
count++; | ||
System.out.println(" Now you have " + count + " tasks in the list."); | ||
break; | ||
case "deadline": | ||
description = string.substring(0, string.indexOf(" /by")).replace("deadline ", ""); | ||
date = string.substring(string.indexOf("/by ")).replace("/by ", ""); | ||
tasks[count] = new Deadline(description, date); | ||
System.out.println(" Got it. I've added this task: "); | ||
System.out.println(" " + tasks[count].toString()); | ||
count++; | ||
System.out.println(" Now you have " + count + " tasks in the list."); | ||
break; | ||
case "event": | ||
description = string.substring(0, string.indexOf(" /at")).replace("event ", ""); | ||
date = string.substring(string.indexOf("/at ")).replace("/at ", ""); | ||
tasks[count] = new Event(description, date); | ||
System.out.println(" Got it. I've added this task: "); | ||
System.out.println(" " + tasks[count].toString()); | ||
count++; | ||
System.out.println(" Now you have " + count + " tasks in the list."); | ||
break; | ||
default: //add Task into List | ||
tasks[count] = new Task(string); | ||
System.out.println(" added: " + tasks[count].getDescription()); | ||
count++; | ||
break; | ||
} | ||
System.out.println(" ____________________________________________________________"); | ||
} | ||
} | ||
} |
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 @@ | ||
public class Event extends Task { | ||
String date; | ||
|
||
public Event(String description, String date) { | ||
super(description); | ||
this.date = date; | ||
} | ||
|
||
public String toString() { | ||
return "[E]" + super.toString() + " (at: " + this.date + ")"; | ||
} | ||
} |
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,30 @@ | ||
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"); //return tick or X symbols | ||
} | ||
|
||
// Not immutable version | ||
public void markAsDone() { | ||
this.isDone = true; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public boolean getIsDone() { | ||
return this.isDone; | ||
} | ||
|
||
public String toString() { | ||
return "[" + getStatusIcon() + "] " + getDescription(); | ||
} | ||
} |
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,9 @@ | ||
public class Todo extends Task { | ||
public Todo(String description) { | ||
super(description); | ||
} | ||
|
||
public String toString() { | ||
return "[T]" + super.toString(); | ||
} | ||
} |
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.
Maybe we should use 'taskCount' to refer to the total number of tasks.