Skip to content
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
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
556af3f
Add Gradle support
May 24, 2020
7412db5
Add *.class to .gitignore
DerenC Jan 26, 2023
5b4ad51
Finish Level-1
DerenC Jan 26, 2023
1986f7c
Finish Level-2
DerenC Jan 26, 2023
2543b85
Change the chatbot's name from Duke to Wessy
DerenC Jan 26, 2023
fb30872
Improve the chatbot's opening message
DerenC Jan 26, 2023
fc5d2f9
Increase indentation to improve the appearance of the displayed message
DerenC Jan 27, 2023
fe4110b
Create 'Task' class
DerenC Jan 27, 2023
c1d02c0
Finish Level-3
DerenC Jan 28, 2023
f2b385f
Finish Level-4
DerenC Jan 30, 2023
17205ad
Clear up unused add functions
DerenC Jan 30, 2023
d444660
Finish Level-5
DerenC Jan 30, 2023
ba548a7
Modify EXPECTED.TXT & input.txt
DerenC Jan 30, 2023
6ef4659
Finish Level-6
DerenC Jan 30, 2023
6b4ecc8
Use enumerations instead of strings in Wessy (main driver) class
DerenC Jan 30, 2023
da15bb8
Complete checkstyle based on CS2030's standard
DerenC Jan 30, 2023
9cca35c
Finish Level-7
DerenC Feb 2, 2023
43e8e99
Finish Level-8
DerenC Feb 3, 2023
0e21ec3
Merge branch 'branch-Level-7'
DerenC Feb 3, 2023
72eb4cf
Merge branch 'branch-Level-8'
DerenC Feb 3, 2023
551cf7b
Merge remote-tracking branch 'remotes/origin/add-gradle-support'
DerenC Feb 3, 2023
388ae95
Initial setup of Gradle
DerenC Feb 5, 2023
4a61459
Finish A-MoreOOP
DerenC Feb 9, 2023
0a0f3f6
A-Packages
DerenC Feb 9, 2023
46e7bfe
Add JUnit test to test getCmd(), parseDateTime(), removeSpacePadding(…
DerenC Feb 9, 2023
88ec341
Create jar file for version release
DerenC Feb 9, 2023
8707b3e
Add Java documentation for some classes.
DerenC Feb 12, 2023
16f36ec
Finish A-CodingStandard
DerenC Feb 12, 2023
df037e7
Finish Level-9
DerenC Feb 12, 2023
a26aeeb
Merge branch 'branch-Level-9'
DerenC Feb 12, 2023
f8954a0
Merge branch 'branch-A-JavaDoc'
DerenC Feb 12, 2023
9ebbab9
Merge branch 'branch-A-CodingStandard'
DerenC Feb 12, 2023
98fa419
Add a basic GUI to Wessy
DerenC Feb 21, 2023
d387abf
Rename methods in Ui from prints to gets
DerenC Feb 21, 2023
cd2818d
Refactor the code by applying more OOP principle
DerenC Feb 9, 2023
d40651d
Merge commit 'cd2818dd855ef73b919892fe0703f1bef09f8db5'
DerenC Feb 21, 2023
8431958
Delete unnecessary java files outside the main.java.wessy directory
DerenC Feb 22, 2023
432a76b
Use Assertions
DerenC Feb 22, 2023
2a8e5da
Improve code quality
DerenC Feb 22, 2023
0bedb08
Use Streams
DerenC Feb 22, 2023
8da4963
Merge pull request #4 from DerenC/branch-A-Streams
DerenC Feb 22, 2023
ef63a64
Merge branch 'master' into branch-A-Assertions
DerenC Feb 22, 2023
e9b5032
Merge pull request #2 from DerenC/branch-A-Assertions
DerenC Feb 22, 2023
ea08add
Merge branch 'master' into branch-A-CodeQuality
DerenC Feb 22, 2023
370968f
Merge pull request #3 from DerenC/branch-A-CodeQuality
DerenC Feb 22, 2023
6bfaf73
Delete commented-out code used for Ui in Wessy.java
DerenC Feb 22, 2023
bce0f40
Declutter by deleting commented-out codes
DerenC Feb 22, 2023
35838ce
Comment out System.in as standardInput
DerenC Feb 23, 2023
8e57710
Implemented 2 extensions from category B
DerenC Feb 23, 2023
054a500
Add a User Guide
DerenC Feb 24, 2023
09999ca
Minor correction on phrasing of descrption of Feature #3
DerenC Feb 24, 2023
cda7911
Second minor correction on phrasing of descrption of Feature #3
DerenC Feb 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ bin/

/text-ui-test/ACTUAL.TXT
text-ui-test/EXPECTED-UNIX.TXT

*.class

/src/main/java/checkstyle-8.2-all.jar
/src/main/java/cs2030_checks.xml
3 changes: 3 additions & 0 deletions data/Wessy.txt
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
27 changes: 27 additions & 0 deletions src/main/java/CmdType.java
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();
}
}
32 changes: 32 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import java.time.LocalDateTime;

public class Deadline extends Task {
Copy link

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

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;
}
}
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

34 changes: 34 additions & 0 deletions src/main/java/Event.java
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;
}
}
7 changes: 7 additions & 0 deletions src/main/java/Exceptions/CommandNotFoundException.java
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 :-(");
}
}
7 changes: 7 additions & 0 deletions src/main/java/Exceptions/EmptyListException.java
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 + ".");
}
}
22 changes: 22 additions & 0 deletions src/main/java/Exceptions/MissingInputException.java
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;
}
}
7 changes: 7 additions & 0 deletions src/main/java/Exceptions/MissingSpacingException.java
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));
}
}
7 changes: 7 additions & 0 deletions src/main/java/Exceptions/UnspecifiedTimeException.java
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));
}
}
15 changes: 15 additions & 0 deletions src/main/java/Exceptions/WessyException.java
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;
}
}
35 changes: 35 additions & 0 deletions src/main/java/Task.java
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;
}
}
19 changes: 19 additions & 0 deletions src/main/java/ToDo.java
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();
}
}
Loading