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

[Bian Rui] iP #60

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

[Bian Rui] iP #60

wants to merge 24 commits into from

Conversation

Brominne
Copy link

No description provided.

@Brominne Brominne changed the title Added Level0-3 [Bian Rui] iP Aug 29, 2022
import java.util.Arrays;

public class Storage {
private static final String IDLE_MESSAGE = "Nothing happened QaQ";

Choose a reason for hiding this comment

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

good use of constants! makes the code very neat and readable

public class Task {
protected String description;
protected boolean isDone;
protected static int TIME_SEPARATOR_LENGTH = 5; //length of separator from input, eg: /at:, /by:

Choose a reason for hiding this comment

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

good use of constants

*/
public void execute(String cmd) {
String[] words = cmd.split(COMMAND_SEPARATOR);
switch (words[0]) {

Choose a reason for hiding this comment

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

good switch indentations

@@ -0,0 +1,30 @@
public class Task {
protected String description;
protected boolean isDone;

Choose a reason for hiding this comment

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

correct naming standard of booleans

Copy link

@Than-Duc-Huy Than-Duc-Huy left a comment

Choose a reason for hiding this comment

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

Overall, it is a good and neat code! All the magic literals are defined as constants. OOP, encapsulation and compartmentalization are clean! :)


@Override
public String getStatusIcon() {
String statusIcon = "[E]";

Choose a reason for hiding this comment

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

Use your predefined constant EVENT_MARK

Copy link

@hughjazzman hughjazzman left a comment

Choose a reason for hiding this comment

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

Great code, see comments. 👍

int TIME_IDENTIFIER_LENGTH = 5;

static void checkNullString(String string) throws WrongCommandFormatException {
if(string.replaceAll("\\s+","").equals("")) {

Choose a reason for hiding this comment

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

Just a space!

Suggested change
if(string.replaceAll("\\s+","").equals("")) {
if (string.replaceAll("\\s+","").equals("")) {


try {
if (cmds[0].equalsIgnoreCase(COMMAND_MARK)) {
list[Integer.parseInt(cmds[1]) - 1].setIsDone(true);

Choose a reason for hiding this comment

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

private static final String TODO_MARK = "[T]";

/**
* Deafult constructor for a Todo instance

Choose a reason for hiding this comment

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

Mini typo.

Suggested change
* Deafult constructor for a Todo instance
* Default constructor for a Todo instance

Brominne added 5 commits September 14, 2022 21:30
* branch-Level-7:
  Add load and save file feature

# Conflicts:
#	src/main/java/Storage.java
Copy link

@hughjazzman hughjazzman left a comment

Choose a reason for hiding this comment

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

Not much to add, great job 💯


@Override
public String getTime() {
return this.time;

Choose a reason for hiding this comment

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

Perhaps you can avoid the unnecessary use of this.

Suggested change
return this.time;
return time;

https://se-education.org/guides/conventions/java/index.html#variables

}

static void writeFile(ArrayList<Task> Tasks) throws IOException {
FileWriter fw = new FileWriter("/Users/bromine/ip/Saves/Tasks");

Choose a reason for hiding this comment

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

Seems the Path is repeated twice, could it be better as a constant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants