-
Notifications
You must be signed in to change notification settings - Fork 361
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
[Cheng Deren] iP #367
Open
DerenC
wants to merge
52
commits into
nus-cs2103-AY2223S2:master
Choose a base branch
from
DerenC: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
[Cheng Deren] iP #367
Changes from 19 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
556af3f
Add Gradle support
7412db5
Add *.class to .gitignore
DerenC 5b4ad51
Finish Level-1
DerenC 1986f7c
Finish Level-2
DerenC 2543b85
Change the chatbot's name from Duke to Wessy
DerenC fb30872
Improve the chatbot's opening message
DerenC fc5d2f9
Increase indentation to improve the appearance of the displayed message
DerenC fe4110b
Create 'Task' class
DerenC c1d02c0
Finish Level-3
DerenC f2b385f
Finish Level-4
DerenC 17205ad
Clear up unused add functions
DerenC d444660
Finish Level-5
DerenC ba548a7
Modify EXPECTED.TXT & input.txt
DerenC 6ef4659
Finish Level-6
DerenC 6b4ecc8
Use enumerations instead of strings in Wessy (main driver) class
DerenC da15bb8
Complete checkstyle based on CS2030's standard
DerenC 9cca35c
Finish Level-7
DerenC 43e8e99
Finish Level-8
DerenC 0e21ec3
Merge branch 'branch-Level-7'
DerenC 72eb4cf
Merge branch 'branch-Level-8'
DerenC 551cf7b
Merge remote-tracking branch 'remotes/origin/add-gradle-support'
DerenC 388ae95
Initial setup of Gradle
DerenC 4a61459
Finish A-MoreOOP
DerenC 0a0f3f6
A-Packages
DerenC 46e7bfe
Add JUnit test to test getCmd(), parseDateTime(), removeSpacePadding(…
DerenC 88ec341
Create jar file for version release
DerenC 8707b3e
Add Java documentation for some classes.
DerenC 16f36ec
Finish A-CodingStandard
DerenC df037e7
Finish Level-9
DerenC a26aeeb
Merge branch 'branch-Level-9'
DerenC f8954a0
Merge branch 'branch-A-JavaDoc'
DerenC 9ebbab9
Merge branch 'branch-A-CodingStandard'
DerenC 98fa419
Add a basic GUI to Wessy
DerenC d387abf
Rename methods in Ui from prints to gets
DerenC cd2818d
Refactor the code by applying more OOP principle
DerenC d40651d
Merge commit 'cd2818dd855ef73b919892fe0703f1bef09f8db5'
DerenC 8431958
Delete unnecessary java files outside the main.java.wessy directory
DerenC 432a76b
Use Assertions
DerenC 2a8e5da
Improve code quality
DerenC 0bedb08
Use Streams
DerenC 8da4963
Merge pull request #4 from DerenC/branch-A-Streams
DerenC ef63a64
Merge branch 'master' into branch-A-Assertions
DerenC e9b5032
Merge pull request #2 from DerenC/branch-A-Assertions
DerenC ea08add
Merge branch 'master' into branch-A-CodeQuality
DerenC 370968f
Merge pull request #3 from DerenC/branch-A-CodeQuality
DerenC 6bfaf73
Delete commented-out code used for Ui in Wessy.java
DerenC bce0f40
Declutter by deleting commented-out codes
DerenC 35838ce
Comment out System.in as standardInput
DerenC 8e57710
Implemented 2 extensions from category B
DerenC 054a500
Add a User Guide
DerenC 09999ca
Minor correction on phrasing of descrption of Feature #3
DerenC cda7911
Second minor correction on phrasing of descrption of Feature #3
DerenC 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
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,3 @@ | ||
T~%~0~%~Chicken | ||
D~%~1~%~essay~%~2030 | ||
E~%~0~%~meeting~%~2pm~%~5pm |
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,27 @@ | ||
public enum CmdType { | ||
LIST("list"), | ||
BYE("bye"), | ||
MARK("mark"), | ||
UNMARK("unmark"), | ||
TODO("todo"), | ||
DEADLINE("deadline"), | ||
EVENT("event"), | ||
DELETE("delete"), | ||
|
||
CLEAR("clear"); | ||
|
||
private final String cmd; | ||
|
||
CmdType(String str) { | ||
this.cmd = str; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return cmd; | ||
} | ||
|
||
public int len() { | ||
return cmd.length(); | ||
} | ||
} |
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,32 @@ | ||
import java.time.LocalDateTime; | ||
|
||
public class Deadline extends Task { | ||
protected LocalDateTime by; | ||
|
||
public Deadline(String description, LocalDateTime by, boolean isDone){ | ||
super(description, isDone); | ||
this.by=by; | ||
} | ||
|
||
public Deadline(String description, LocalDateTime by) { | ||
this(description, by, false); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[D]" + super.toString() + " (by: " + timeToString(by) + ")"; | ||
} | ||
|
||
public static String timeToString(LocalDateTime dateTime) { | ||
String str = dateTime.toString(); | ||
if (str.substring(11).equals("12:34:56")) { | ||
return str.substring(0, 10); | ||
} | ||
return str.substring(0, 10) + " " + str.substring(11, 16); | ||
} | ||
|
||
@Override | ||
public String saveAsStr() { | ||
return "D" + super.saveAsStr() + "~%~" + by; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
import java.time.LocalDateTime; | ||
|
||
public class Event extends Task { | ||
protected LocalDateTime from; | ||
protected LocalDateTime to; | ||
|
||
public Event(String description, LocalDateTime from, LocalDateTime to, boolean isDone) { | ||
super(description, isDone); | ||
this.from = from; | ||
this.to = to; | ||
} | ||
|
||
public Event(String description, LocalDateTime from, LocalDateTime to) { | ||
this(description, from, to, false); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[E]" + super.toString() + " (from: " + timeToString(from) + " to: " + timeToString(to) + ")"; | ||
} | ||
|
||
public static String timeToString(LocalDateTime dateTime) { | ||
String str = dateTime.toString(); | ||
if (str.substring(11).equals("12:34:56")) { | ||
return str.substring(0, 10); | ||
} | ||
return str.substring(0, 10) + " " + str.substring(11, 16); | ||
} | ||
|
||
@Override | ||
public String saveAsStr() { | ||
return "E" + super.saveAsStr() + "~%~" + from + "~%~" + to; | ||
} | ||
} |
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,7 @@ | ||
package Exceptions; | ||
|
||
public class CommandNotFoundException extends WessyException { | ||
public CommandNotFoundException() { | ||
super("I'm sorry, but I don't know what that means :-("); | ||
} | ||
} |
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,7 @@ | ||
package Exceptions; | ||
|
||
public class EmptyListException extends WessyException { | ||
public EmptyListException(String cmd) { | ||
super("You do not have any task on the list for you to " + cmd + "."); | ||
} | ||
} |
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,22 @@ | ||
package Exceptions; | ||
|
||
public class MissingInputException extends WessyException { | ||
static String ENDING = " cannot be empty."; | ||
private final String cmd; | ||
|
||
public MissingInputException(String cmd) { | ||
super(cmd.substring(cmd.length() - 4).equals("mark") ? "The chosen task number of " : "The description of "); | ||
this.cmd = cmd; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String article = "a "; | ||
if (cmd.equals("mark") || cmd.equals("unmark")) { | ||
article = cmd.equals("mark") ? "a " : "an "; | ||
} else if (cmd.equals("todo") || cmd.equals("deadline") || cmd.equals("event")){ | ||
article = cmd.equals("event")?"an ":"a "; | ||
} | ||
return super.toString() + article + cmd + ENDING; | ||
} | ||
} |
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,7 @@ | ||
package Exceptions; | ||
|
||
public class MissingSpacingException extends WessyException { | ||
public MissingSpacingException(String keyword, boolean after) { | ||
super(String.format("The spacing %s '%s' is missing", after ? "after" : "before", keyword)); | ||
} | ||
} |
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,7 @@ | ||
package Exceptions; | ||
|
||
public class UnspecifiedTimeException extends WessyException { | ||
public UnspecifiedTimeException(String keyword) { | ||
super(String.format("The '%s' timing is missing.", keyword)); | ||
} | ||
} |
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,15 @@ | ||
package Exceptions; | ||
|
||
public class WessyException extends Exception { | ||
private final String message; | ||
static String OPENING = "☹ OOPS!!! "; | ||
|
||
WessyException(String str) { | ||
this.message = OPENING + str; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return message; | ||
} | ||
} |
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,35 @@ | ||
public class Task { | ||
protected final String description; | ||
protected boolean isDone; | ||
|
||
public Task(String description, boolean isDone) { | ||
this.description = description; | ||
this.isDone = isDone; | ||
} | ||
|
||
public Task(String description) { | ||
this(description, false); | ||
} | ||
|
||
String getStatusIcon() { | ||
return (isDone ? "X" : " "); // mark done task with X | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[" + getStatusIcon() + "] " + description; | ||
} | ||
|
||
public String saveAsStr() { | ||
String mark = isDone ? "1" : "0"; | ||
return "~%~" + mark + "~%~" + description; | ||
} | ||
|
||
public void mark() { | ||
isDone = true; | ||
} | ||
|
||
public void unmark() { | ||
isDone = false; | ||
} | ||
} |
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 @@ | ||
public class ToDo extends Task { | ||
public ToDo(String description, boolean isDone) { | ||
super(description, isDone); | ||
} | ||
|
||
public ToDo(String description) { | ||
this(description, false); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[T]" + super.toString(); | ||
} | ||
|
||
@Override | ||
public String saveAsStr() { | ||
return "T" + super.saveAsStr(); | ||
} | ||
} |
Oops, something went wrong.
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.
Perhaps can put this class into a package (like package duke), as other developers could better understand the code base when all the classes have been grouped in packages