-
Notifications
You must be signed in to change notification settings - Fork 429
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
[Wong Zenwei] iP #446
base: master
Are you sure you want to change the base?
[Wong Zenwei] iP #446
Conversation
In build.gradle, the dependencies on distZip and/or distTar causes the shadowJar task to generate a second JAR file for which the mainClass.set("seedu.duke.Duke") does not take effect. Hence, this additional JAR file cannot be run. For this product, there is no need to generate a second JAR file to begin with. Let's remove this dependency from the build.gradle to prevent the shadowJar task from generating the extra JAR file.
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.
Good job so far, a clean base code to work on going forward.
Some minor coding standard changes requested.
src/main/java/Jeff.java
Outdated
switch (parsed[0]) { | ||
case "list": | ||
String items = ""; | ||
for (int i = 0; i < list.size(); i++) { | ||
items += " " + (i + 1) + ". " + list.get(i) + "\n"; | ||
} | ||
message = "____________________________________________________________\n" + | ||
" Here are the tasks in your list:\n" + | ||
items + | ||
"____________________________________________________________\n"; | ||
break; | ||
case "mark": | ||
int index = Integer.parseInt(parsed[1]) - 1; | ||
list.get(index).setDone(); | ||
message = "____________________________________________________________\n" + | ||
" Nice! I've marked this task as done:\n" + | ||
" " + list.get(index) + "\n" + | ||
"____________________________________________________________\n"; | ||
break; | ||
case "unmark": | ||
int ind = Integer.parseInt(parsed[1]) - 1; | ||
list.get(ind).setNotDone(); | ||
message = "____________________________________________________________\n" + | ||
" OK, I've marked this task as not done yet:\n" + | ||
" " + list.get(ind) + "\n" + | ||
"____________________________________________________________\n"; | ||
break; | ||
default: | ||
list.add(new Task(input)); | ||
message = "____________________________________________________________\n" + | ||
" added: " + input + "\n" + | ||
"____________________________________________________________\n"; | ||
} |
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.
The switch statement should have no indentation for case clauses according to coding standard
switch (parsed[0]) { | |
case "list": | |
String items = ""; | |
for (int i = 0; i < list.size(); i++) { | |
items += " " + (i + 1) + ". " + list.get(i) + "\n"; | |
} | |
message = "____________________________________________________________\n" + | |
" Here are the tasks in your list:\n" + | |
items + | |
"____________________________________________________________\n"; | |
break; | |
case "mark": | |
int index = Integer.parseInt(parsed[1]) - 1; | |
list.get(index).setDone(); | |
message = "____________________________________________________________\n" + | |
" Nice! I've marked this task as done:\n" + | |
" " + list.get(index) + "\n" + | |
"____________________________________________________________\n"; | |
break; | |
case "unmark": | |
int ind = Integer.parseInt(parsed[1]) - 1; | |
list.get(ind).setNotDone(); | |
message = "____________________________________________________________\n" + | |
" OK, I've marked this task as not done yet:\n" + | |
" " + list.get(ind) + "\n" + | |
"____________________________________________________________\n"; | |
break; | |
default: | |
list.add(new Task(input)); | |
message = "____________________________________________________________\n" + | |
" added: " + input + "\n" + | |
"____________________________________________________________\n"; | |
} | |
switch (parsed[0]) { | |
case "list": | |
String items = ""; | |
for (int i = 0; i < list.size(); i++) { | |
items += " " + (i + 1) + ". " + list.get(i) + "\n"; | |
} | |
message = "____________________________________________________________\n" + | |
" Here are the tasks in your list:\n" + | |
items + | |
"____________________________________________________________\n"; | |
break; | |
case "mark": | |
int index = Integer.parseInt(parsed[1]) - 1; | |
list.get(index).setDone(); | |
message = "____________________________________________________________\n" + | |
" Nice! I've marked this task as done:\n" + | |
" " + list.get(index) + "\n" + | |
"____________________________________________________________\n"; | |
break; | |
case "unmark": | |
int ind = Integer.parseInt(parsed[1]) - 1; | |
list.get(ind).setNotDone(); | |
message = "____________________________________________________________\n" + | |
" OK, I've marked this task as not done yet:\n" + | |
" " + list.get(ind) + "\n" + | |
"____________________________________________________________\n"; | |
break; | |
default: | |
list.add(new Task(input)); | |
message = "____________________________________________________________\n" + | |
" added: " + input + "\n" + | |
"____________________________________________________________\n"; | |
} |
src/main/java/Jeff.java
Outdated
String greetings = "____________________________________________________________\n" + | ||
" Hello! I'm Jeff\n" + | ||
" What can I do for you?\n" + | ||
"____________________________________________________________\n"; |
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.
When wrapping lines, break should be before an operator.
I noticed this issues in several other places as well.
Do take note!
String greetings = "____________________________________________________________\n" + | |
" Hello! I'm Jeff\n" + | |
" What can I do for you?\n" + | |
"____________________________________________________________\n"; | |
String greetings = "____________________________________________________________\n" | |
+ " Hello! I'm Jeff\n" | |
+ " What can I do for you?\n" | |
+ "____________________________________________________________\n"; |
src/main/java/Jeff.java
Outdated
import java.util.Objects; | ||
import java.util.Scanner; | ||
import java.util.ArrayList; |
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 this should be sorted in alphabetical order?
src/main/java/Jeff.java
Outdated
import java.util.ArrayList; | ||
|
||
public class Jeff { | ||
public static class Task { |
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.
Good intuition to abstract the Task class! 👍
src/main/java/Jeff.java
Outdated
public class Jeff { | ||
public static class Task { | ||
private String desc; | ||
private boolean done; |
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.
If I recall correctly, variable names for boolean should be named like a boolean.
e.g use a prefix such as is
, has
, was
src/main/java/Jeff.java
Outdated
String greetings = "____________________________________________________________\n" + | ||
" Hello! I'm Jeff\n" + | ||
" What can I do for you?\n" + | ||
"____________________________________________________________\n"; |
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 it might be easier in the future to extract the print line to keep as a constant.
[Wong Zenwei] iP Pull Request
Features
Steps for next increment
text-ui-test
in Duke repoIncrements to be done 😭
A-TextUiTesting
Level-5
Level-6
A-Enums
Level-7
Level-8
A-MoreOOP
A-Packages
A-Gradle
A-JUnit
A-Jar
A-JavaDoc
A-CodingStandard
Level-9
A-CheckStyle
Level-10
A-Varargs