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

[Tan Gee Teng] iP #281

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d839859
Add Gradle support
May 24, 2020
ba88212
level-1
geetengtan Jan 18, 2022
8278dd9
level-1
geetengtan Jan 18, 2022
aae4682
level-2
geetengtan Jan 18, 2022
753acd7
Mark as Done
geetengtan Jan 18, 2022
b696fe4
ToDos, Events, Deadlines
geetengtan Jan 18, 2022
5df357a
Automated Text UI Testing
geetengtan Jan 18, 2022
b839e06
Handle Errors
geetengtan Jan 18, 2022
621bb3a
Delete
geetengtan Jan 18, 2022
7d77ec9
Simplify code
geetengtan Jan 25, 2022
8e7d18f
Add save feature
geetengtan Jan 25, 2022
786bcef
Add date time formatting
geetengtan Jan 26, 2022
a261db1
test branching
geetengtan Jan 26, 2022
2ef0d93
Merge branch 'branch-Level-7'
geetengtan Jan 26, 2022
8bcf1bf
Merge branch 'branch-Level-8'
geetengtan Jan 26, 2022
b0ee8f3
Fix bug for merging
geetengtan Jan 26, 2022
ed76196
Use More OOP
geetengtan Jan 26, 2022
de4db61
Organize into Packages
geetengtan Jan 26, 2022
ed074ac
Fix bugs and Add JUnit Test
geetengtan Feb 1, 2022
8b73153
Merge remote-tracking branch 'origin/add-gradle-support'
geetengtan Feb 1, 2022
c87aecb
Fix Gradle bugs and add jar
geetengtan Feb 1, 2022
6c080c7
Add JavaDoc
geetengtan Feb 2, 2022
50bd80a
Fix bugs and add Find Feature
geetengtan Feb 2, 2022
dca73b3
Fix gradle properties
geetengtan Feb 2, 2022
d6dbbd6
Follow Coding Standard for 2103
geetengtan Feb 2, 2022
1337e0b
Merge branch 'branch-Level-9'
geetengtan Feb 2, 2022
5050475
Merge branch 'branch-A-JavaDoc'
geetengtan Feb 2, 2022
558c6e3
Improve code readability
geetengtan Feb 2, 2022
e3a7aca
GUI
geetengtan Feb 3, 2022
8ae7ca4
Add Pictures
geetengtan Feb 3, 2022
1c370ee
Improve code quality
geetengtan Feb 6, 2022
93993c4
Find command: make matching case insensitive
geetengtan Feb 6, 2022
89ea9c9
Improve code quality
geetengtan Feb 7, 2022
40f3d93
Add assertions
geetengtan Feb 7, 2022
cf1bff7
Merge branch 'branch-A-CodeQuality'
geetengtan Feb 7, 2022
1033df2
Add Notes feature
geetengtan Feb 7, 2022
f84d529
Add HELP feature
geetengtan Feb 7, 2022
e4fb4ce
Change UI and update README
geetengtan Feb 12, 2022
0da1a0a
update README and CodeQuality
geetengtan Feb 12, 2022
0e4e193
fix storage bug
geetengtan Feb 12, 2022
244524e
Merge pull request #2 from geetengtan/branch-MergingPR
geetengtan Feb 17, 2022
49c5706
made storage cross-platform
geetengtan Feb 17, 2022
1f7c66f
fix javafx version
geetengtan Feb 18, 2022
01d3105
fix fxml version
geetengtan Feb 18, 2022
f6b5d37
update README and UG
geetengtan Apr 13, 2022
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
4 changes: 3 additions & 1 deletion data/duke.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
T#false#borrow book
T#true#borrow book
D#false#return book #2021-02-02
T#false#play
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Feb 02 12:10:36 MYT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
14 changes: 12 additions & 2 deletions src/main/java/seedu/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ public class Parser {
private static final int MARK = 4;
private static final int UNMARK = 5;
private static final int DELETE = 6;

private static final int FIND = 7;

/**
* Reads the String input and determines the type of command to execute and returns it as an integer
*
* @param input User input for the <code>Duke</code> program
* @return An integer to represent the type of command to execute
* @throws DukeException When String input doesn't match any type of command
*/
public static int getCommand(String input) throws DukeException {
String str = input.split(" ", 2)[0];

Expand All @@ -28,7 +36,9 @@ public static int getCommand(String input) throws DukeException {
return UNMARK;
} else if (str.equals("delete")) {
return DELETE;
} else {
} else if (str.equals("find")) {
return FIND;
}else {
throw new DukeException("OOPS!!! I don't understand what that means");
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/duke/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void save(TaskList tasks) {
if (t instanceof ToDo) {
saveFormat += "T#";
saveFormat += t.isDone ? "true" : "false";
saveFormat += "#" + t.description;
saveFormat += "#" + t.description + "\n";
continue;
} else if (t instanceof Deadline) {
saveFormat += "D";
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/seedu/duke/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,25 @@ public String count() {
return "\n Now you have " + tasks.size() + " task" + isSingular + " in your list.";
}

public String find(String keyword) {
String resultStr = "";
boolean keywordFound = false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boolean variable should use a prefix such as is, has, was.

int i = 1;

for (Task t : this.tasks) {
if (t.description.contains(keyword)) {
keywordFound = true;
resultStr += i++ + ". " + t + "\n ";
}
}

if (keywordFound) {
resultStr = "Here are the matching tasks in your list:\n " + resultStr;
} else {
resultStr = "No matching results found in the list.";
}

return resultStr;
}

}
9 changes: 8 additions & 1 deletion src/main/java/seedu/duke/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ public class Ui {
private static final int MARK = 4;
private static final int UNMARK = 5;
private static final int DELETE = 6;

private static final int FIND = 7;

/**
* Prints an error message for failure in loading files
*/
public void showLoadingError() {
System.out.println("Failed to retrieve data from storage");
}
Expand Down Expand Up @@ -40,6 +44,9 @@ public void nextInput(String input, TaskList tasks) {
case DELETE:
myPrint(tasks.delete(Parser.getIndex(input)));
break;
case FIND:
myPrint(tasks.find(Parser.getDescription(input)));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it will be better to change the myprint() method name to something that would explain the function better

break;
}
} catch (DukeException e) {
myPrint(e.toString());
Expand Down