-
Notifications
You must be signed in to change notification settings - Fork 271
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
[Edward Alvin] ip #294
base: master
Are you sure you want to change the base?
[Edward Alvin] ip #294
Conversation
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 code thus far looks good! 👍🏼
Just some suggestions and nits to fix.
public static void processInput(InputType inputType, String[] value) { | ||
switch(inputType) { | ||
case LIST: | ||
wordList.printList(); | ||
break; | ||
case MARK: | ||
wordList.markItem(Integer.parseInt(value[0])); | ||
break; | ||
case UNMARK: | ||
wordList.unmarkItem(Integer.parseInt(value[0])); | ||
break; | ||
case TODO: | ||
wordList.storeTodo(value[0]); | ||
break; | ||
case DEADLINE: | ||
wordList.storeDeadline(value[0], value[1]); | ||
break; | ||
case EVENT: | ||
wordList.storeEvent(value[0], value[1]); | ||
break; | ||
case BYE: | ||
replyBye(); | ||
break; | ||
case NONE: | ||
break; | ||
} | ||
} |
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 coding standard for this module requires no indentation for the case
clauses under switch
! Perhaps you can configure your IDE to follow this new standard by default.
@@ -0,0 +1,17 @@ | |||
public enum InputType { |
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.
Interesting way to use enums!
@@ -0,0 +1,14 @@ | |||
public class Deadline extends WordListItem{ |
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.
public class Deadline extends WordListItem{ | |
public class Deadline extends WordListItem { |
Be careful with the spacing requirements for Egyptian style brackets!
@Override | ||
public String toString() { | ||
int i = 1; | ||
String str = ""; | ||
str += "------------------------------------\n"; | ||
for(WordListItem wordListItem: this.wordList) { | ||
str += i + ". " + wordListItem + "\n"; | ||
i++; | ||
} | ||
str += "------------------------------------\n"; | ||
return str; | ||
} | ||
} |
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.
I think you can make use of the toString()
method of WordListItem
directly in printList()
, instead of returning a complicated String
expression here.
No description provided.