-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create NegateCommand abstract class and add unremind command #118
Create NegateCommand abstract class and add unremind command #118
Conversation
Codecov Report
@@ Coverage Diff @@
## master #118 +/- ##
============================================
+ Coverage 55.48% 56.07% +0.58%
- Complexity 447 461 +14
============================================
Files 90 93 +3
Lines 1768 1803 +35
Branches 209 213 +4
============================================
+ Hits 981 1011 +30
- Misses 739 740 +1
- Partials 48 52 +4
Continue to review full report at Codecov.
|
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.
Looks good! Just a few comments haha
@@ -10,7 +10,7 @@ | |||
|
|||
/** | |||
* Parses the given {@code String} of arguments in the context of the DeleteCommand |
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.
is this supposed to be 'in the context of RemindCommand' instead of DeleteCommand?
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.
Oh yup. Must have missed it out. I shall go change it now
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.
Amended!
/** | ||
* Represents a command with hidden internal logic and the ability to reverse the execution of other commands. | ||
*/ | ||
public abstract class NegateCommand extends Command { |
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.
does it have to be abstract since this class doesn't contain any abstract methods.. I think a normal class would suffice
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.
At first, I made it a non-abstract class, but then IntelliJ made noise because it extends abstract class Command so i either had to override the execute method in NegataCommand or make NegateCommand abstract. Since I personally felt that overriding the execute method in NegateCommand was a little redundant since the UnremindCommand, UnscheduleCommand and UndoneCommand will override the execute method again, I decided to make the NegateCommand class abstract.
I can change it back to a normal class if you want to though, I shall just override the abstract execute method in NegateCommand if you want to change it to a normal class :)
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 just keep it as an abstract class will do.
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.
oh okay, I didn't know that Command was abstract. ya we can leave it as abstract then
public class UnremindCommandParser implements Parser<UnremindCommand> { | ||
|
||
/** | ||
* Parses the given {@code String} of arguments in the context of the DeleteCommand |
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.
UnremindCommand?
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.
Amended!
model.setAssignment(assignmentInList, assignmentInListReminded); | ||
} | ||
|
||
// Reminded first assignment in filtered list |
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.
second* assignment
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.
Amended!
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.
LGTM. :) I think the abstract class issue is minor and we can leave it as it is for now.
/** | ||
* Represents a command with hidden internal logic and the ability to reverse the execution of other commands. | ||
*/ | ||
public abstract class NegateCommand extends Command { |
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 just keep it as an abstract class will do.
throw new CommandException(MESSAGE_UNREMINDED_ASSIGNMENT); | ||
} | ||
|
||
assert(assignmentToUnremind.isReminded()); |
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 assertion.
import seedu.address.model.assignment.Assignment; | ||
import seedu.address.testutil.AssignmentBuilder; | ||
|
||
public class UnremindCommandTest { |
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 test cases. They cover every case I can think of, so good job.
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.
LGTM! :)
closes #109
closes #113
Implemented unremind command as well to ensure the correctness of NegateCommand class