-
Notifications
You must be signed in to change notification settings - Fork 9
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
[T5A1][T01-T4] Li Shicheng #9
base: master
Are you sure you want to change the base?
Conversation
@@ -85,7 +85,8 @@ public CommandResult execute(String userCommandText) throws Exception { | |||
private CommandResult execute(Command command) throws Exception { | |||
command.setData(addressBook, lastShownList); | |||
CommandResult result = command.execute(); | |||
storage.save(addressBook); | |||
if (command.isMutating()) | |||
storage.save(addressBook); |
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 behavior of the code has been changed. Ensure the header comment and the tests have been updated.
Coding standard violation.
@@ -65,4 +65,9 @@ public int getTargetIndex() { | |||
public void setTargetIndex(int targetIndex) { | |||
this.targetIndex = targetIndex; | |||
} | |||
|
|||
/* | |||
* Returns whether the given command will change the data. |
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.
It is better to mention it returns true if the Command potentially mutates the data (header comments specify a contract, so try to be as precise as possible). E.g. Adding a duplicate person will not mutate data but the corresponding AddCommand object will still return true for this method.
@Li-Shicheng |
No description provided.