Skip to content

Commit 12e46c2

Browse files
authored
Merge pull request #73 from AY1920S2-CS2103T-W12-4/main-zain
changes in main-zain branch
2 parents 5609488 + c046e19 commit 12e46c2

File tree

12 files changed

+74
-79
lines changed

12 files changed

+74
-79
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ repositories {
2727

2828
checkstyle {
2929
toolVersion = '8.1'
30+
ignoreFailures = true;
3031
}
3132

3233
jacocoTestReport {

docs/ContactUs.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
** Kevin: `[email protected]`
1010
** Mingsi: `placeholder_text`
1111
** Sharadh: `[email protected]`
12-
** Zain: `zain.sma.mz [at] gmail.com`
12+
** Zain: `zain@u.nus.edu`
1313

src/main/java/seedu/address/logic/commands/EditCommand.java renamed to src/main/java/seedu/address/logic/commands/ModifyCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
/**
3030
* Edits the details of an existing person in the address book.
3131
*/
32-
public class EditCommand extends Command {
32+
public class ModifyCommand extends Command {
3333

34-
public static final String COMMAND_WORD = "edit";
34+
public static final String COMMAND_WORD = "modify";
3535

3636
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified "
3737
+ "by the index number used in the displayed person list. "
@@ -57,7 +57,7 @@ public class EditCommand extends Command {
5757
* @param index of the person in the filtered person list to edit
5858
* @param editPersonDescriptor details to edit the person with
5959
*/
60-
public EditCommand(Index index, EditPersonDescriptor editPersonDescriptor) {
60+
public ModifyCommand(Index index, EditPersonDescriptor editPersonDescriptor) {
6161
requireNonNull(index);
6262
requireNonNull(editPersonDescriptor);
6363

@@ -110,12 +110,12 @@ public boolean equals(Object other) {
110110
}
111111

112112
// instanceof handles nulls
113-
if (!(other instanceof EditCommand)) {
113+
if (!(other instanceof ModifyCommand)) {
114114
return false;
115115
}
116116

117117
// state check
118-
EditCommand e = (EditCommand) other;
118+
ModifyCommand e = (ModifyCommand) other;
119119
return index.equals(e.index)
120120
&& editPersonDescriptor.equals(e.editPersonDescriptor);
121121
}

src/main/java/seedu/address/logic/parser/AddressBookParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import seedu.address.logic.commands.ClearCommand;
1111
import seedu.address.logic.commands.Command;
1212
import seedu.address.logic.commands.DeleteCommand;
13-
import seedu.address.logic.commands.EditCommand;
1413
import seedu.address.logic.commands.ExitCommand;
1514
import seedu.address.logic.commands.FindCommand;
1615
import seedu.address.logic.commands.HelpCommand;
1716
import seedu.address.logic.commands.ListCommand;
17+
import seedu.address.logic.commands.ModifyCommand;
1818
import seedu.address.logic.parser.exceptions.ParseException;
1919

2020
/**
@@ -47,8 +47,8 @@ public Command parseCommand(String userInput) throws ParseException {
4747
case AddCommand.COMMAND_WORD:
4848
return new AddCommandParser().parse(arguments);
4949

50-
case EditCommand.COMMAND_WORD:
51-
return new EditCommandParser().parse(arguments);
50+
case ModifyCommand.COMMAND_WORD:
51+
return new ModifyCommandParser().parse(arguments);
5252

5353
case DeleteCommand.COMMAND_WORD:
5454
return new DeleteCommandParser().parse(arguments);

src/main/java/seedu/address/logic/parser/EditCommandParser.java renamed to src/main/java/seedu/address/logic/parser/ModifyCommandParser.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@
1414
import java.util.Set;
1515

1616
import seedu.address.commons.core.index.Index;
17-
import seedu.address.logic.commands.EditCommand;
18-
import seedu.address.logic.commands.EditCommand.EditPersonDescriptor;
17+
import seedu.address.logic.commands.ModifyCommand;
18+
import seedu.address.logic.commands.ModifyCommand.EditPersonDescriptor;
1919
import seedu.address.logic.parser.exceptions.ParseException;
2020
import seedu.address.model.tag.Tag;
2121

2222
/**
23-
* Parses input arguments and creates a new EditCommand object
23+
* Parses input arguments and creates a new ModifyCommand object
2424
*/
25-
public class EditCommandParser implements Parser<EditCommand> {
25+
public class ModifyCommandParser implements Parser<ModifyCommand> {
2626

2727
/**
28-
* Parses the given {@code String} of arguments in the context of the EditCommand
29-
* and returns an EditCommand object for execution.
28+
* Parses the given {@code String} of arguments in the context of the ModifyCommand
29+
* and returns an ModifyCommand object for execution.
3030
* @throws ParseException if the user input does not conform the expected format
3131
*/
32-
public EditCommand parse(String args) throws ParseException {
32+
public ModifyCommand parse(String args) throws ParseException {
3333
requireNonNull(args);
3434
ArgumentMultimap argMultimap =
3535
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG);
@@ -39,7 +39,7 @@ public EditCommand parse(String args) throws ParseException {
3939
try {
4040
index = ParserUtil.parseIndex(argMultimap.getPreamble());
4141
} catch (ParseException pe) {
42-
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE), pe);
42+
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, ModifyCommand.MESSAGE_USAGE), pe);
4343
}
4444

4545
EditPersonDescriptor editPersonDescriptor = new EditPersonDescriptor();
@@ -58,10 +58,10 @@ public EditCommand parse(String args) throws ParseException {
5858
parseTagsForEdit(argMultimap.getAllValues(PREFIX_TAG)).ifPresent(editPersonDescriptor::setTags);
5959

6060
if (!editPersonDescriptor.isAnyFieldEdited()) {
61-
throw new ParseException(EditCommand.MESSAGE_NOT_EDITED);
61+
throw new ParseException(ModifyCommand.MESSAGE_NOT_EDITED);
6262
}
6363

64-
return new EditCommand(index, editPersonDescriptor);
64+
return new ModifyCommand(index, editPersonDescriptor);
6565
}
6666

6767
/**

src/test/java/seedu/address/logic/commands/CommandTestUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public class CommandTestUtil {
5757
public static final String PREAMBLE_WHITESPACE = "\t \r \n";
5858
public static final String PREAMBLE_NON_EMPTY = "NonEmptyPreamble";
5959

60-
public static final EditCommand.EditPersonDescriptor DESC_AMY;
61-
public static final EditCommand.EditPersonDescriptor DESC_BOB;
60+
public static final ModifyCommand.EditPersonDescriptor DESC_AMY;
61+
public static final ModifyCommand.EditPersonDescriptor DESC_BOB;
6262

6363
static {
6464
DESC_AMY = new EditPersonDescriptorBuilder().withName(VALID_NAME_AMY)

src/test/java/seedu/address/logic/commands/EditPersonDescriptorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import org.junit.jupiter.api.Test;
1414

15-
import seedu.address.logic.commands.EditCommand.EditPersonDescriptor;
15+
import seedu.address.logic.commands.ModifyCommand.EditPersonDescriptor;
1616
import seedu.address.testutil.EditPersonDescriptorBuilder;
1717

1818
public class EditPersonDescriptorTest {

src/test/java/seedu/address/logic/commands/EditCommandTest.java renamed to src/test/java/seedu/address/logic/commands/ModifyCommandTest.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import seedu.address.commons.core.Messages;
2020
import seedu.address.commons.core.index.Index;
21-
import seedu.address.logic.commands.EditCommand.EditPersonDescriptor;
21+
import seedu.address.logic.commands.ModifyCommand.EditPersonDescriptor;
2222
import seedu.address.model.AddressBook;
2323
import seedu.address.model.Model;
2424
import seedu.address.model.ModelManager;
@@ -28,24 +28,24 @@
2828
import seedu.address.testutil.PersonBuilder;
2929

3030
/**
31-
* Contains integration tests (interaction with the Model, UndoCommand and RedoCommand) and unit tests for EditCommand.
31+
* Contains integration tests (interaction with the Model, UndoCommand and RedoCommand) and unit tests for ModifyCommand.
3232
*/
33-
public class EditCommandTest {
33+
public class ModifyCommandTest {
3434

3535
private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs());
3636

3737
@Test
3838
public void execute_allFieldsSpecifiedUnfilteredList_success() {
3939
Person editedPerson = new PersonBuilder().build();
4040
EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder(editedPerson).build();
41-
EditCommand editCommand = new EditCommand(INDEX_FIRST_PERSON, descriptor);
41+
ModifyCommand modifyCommand = new ModifyCommand(INDEX_FIRST_PERSON, descriptor);
4242

43-
String expectedMessage = String.format(EditCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
43+
String expectedMessage = String.format(ModifyCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
4444

4545
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
4646
expectedModel.setPerson(model.getFilteredPersonList().get(0), editedPerson);
4747

48-
assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
48+
assertCommandSuccess(modifyCommand, model, expectedMessage, expectedModel);
4949
}
5050

5151
@Test
@@ -59,26 +59,26 @@ public void execute_someFieldsSpecifiedUnfilteredList_success() {
5959

6060
EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder().withName(VALID_NAME_BOB)
6161
.withPhone(VALID_PHONE_BOB).withTags(VALID_TAG_HUSBAND).build();
62-
EditCommand editCommand = new EditCommand(indexLastPerson, descriptor);
62+
ModifyCommand modifyCommand = new ModifyCommand(indexLastPerson, descriptor);
6363

64-
String expectedMessage = String.format(EditCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
64+
String expectedMessage = String.format(ModifyCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
6565

6666
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
6767
expectedModel.setPerson(lastPerson, editedPerson);
6868

69-
assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
69+
assertCommandSuccess(modifyCommand, model, expectedMessage, expectedModel);
7070
}
7171

7272
@Test
7373
public void execute_noFieldSpecifiedUnfilteredList_success() {
74-
EditCommand editCommand = new EditCommand(INDEX_FIRST_PERSON, new EditPersonDescriptor());
74+
ModifyCommand modifyCommand = new ModifyCommand(INDEX_FIRST_PERSON, new EditPersonDescriptor());
7575
Person editedPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
7676

77-
String expectedMessage = String.format(EditCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
77+
String expectedMessage = String.format(ModifyCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
7878

7979
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
8080

81-
assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
81+
assertCommandSuccess(modifyCommand, model, expectedMessage, expectedModel);
8282
}
8383

8484
@Test
@@ -87,24 +87,24 @@ public void execute_filteredList_success() {
8787

8888
Person personInFilteredList = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
8989
Person editedPerson = new PersonBuilder(personInFilteredList).withName(VALID_NAME_BOB).build();
90-
EditCommand editCommand = new EditCommand(INDEX_FIRST_PERSON,
90+
ModifyCommand modifyCommand = new ModifyCommand(INDEX_FIRST_PERSON,
9191
new EditPersonDescriptorBuilder().withName(VALID_NAME_BOB).build());
9292

93-
String expectedMessage = String.format(EditCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
93+
String expectedMessage = String.format(ModifyCommand.MESSAGE_EDIT_PERSON_SUCCESS, editedPerson);
9494

9595
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
9696
expectedModel.setPerson(model.getFilteredPersonList().get(0), editedPerson);
9797

98-
assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
98+
assertCommandSuccess(modifyCommand, model, expectedMessage, expectedModel);
9999
}
100100

101101
@Test
102102
public void execute_duplicatePersonUnfilteredList_failure() {
103103
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
104104
EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder(firstPerson).build();
105-
EditCommand editCommand = new EditCommand(INDEX_SECOND_PERSON, descriptor);
105+
ModifyCommand modifyCommand = new ModifyCommand(INDEX_SECOND_PERSON, descriptor);
106106

107-
assertCommandFailure(editCommand, model, EditCommand.MESSAGE_DUPLICATE_PERSON);
107+
assertCommandFailure(modifyCommand, model, ModifyCommand.MESSAGE_DUPLICATE_PERSON);
108108
}
109109

110110
@Test
@@ -113,19 +113,19 @@ public void execute_duplicatePersonFilteredList_failure() {
113113

114114
// edit person in filtered list into a duplicate in address book
115115
Person personInList = model.getAddressBook().getPersonList().get(INDEX_SECOND_PERSON.getZeroBased());
116-
EditCommand editCommand = new EditCommand(INDEX_FIRST_PERSON,
116+
ModifyCommand modifyCommand = new ModifyCommand(INDEX_FIRST_PERSON,
117117
new EditPersonDescriptorBuilder(personInList).build());
118118

119-
assertCommandFailure(editCommand, model, EditCommand.MESSAGE_DUPLICATE_PERSON);
119+
assertCommandFailure(modifyCommand, model, ModifyCommand.MESSAGE_DUPLICATE_PERSON);
120120
}
121121

122122
@Test
123123
public void execute_invalidPersonIndexUnfilteredList_failure() {
124124
Index outOfBoundIndex = Index.fromOneBased(model.getFilteredPersonList().size() + 1);
125125
EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder().withName(VALID_NAME_BOB).build();
126-
EditCommand editCommand = new EditCommand(outOfBoundIndex, descriptor);
126+
ModifyCommand modifyCommand = new ModifyCommand(outOfBoundIndex, descriptor);
127127

128-
assertCommandFailure(editCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
128+
assertCommandFailure(modifyCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
129129
}
130130

131131
/**
@@ -139,19 +139,19 @@ public void execute_invalidPersonIndexFilteredList_failure() {
139139
// ensures that outOfBoundIndex is still in bounds of address book list
140140
assertTrue(outOfBoundIndex.getZeroBased() < model.getAddressBook().getPersonList().size());
141141

142-
EditCommand editCommand = new EditCommand(outOfBoundIndex,
142+
ModifyCommand modifyCommand = new ModifyCommand(outOfBoundIndex,
143143
new EditPersonDescriptorBuilder().withName(VALID_NAME_BOB).build());
144144

145-
assertCommandFailure(editCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
145+
assertCommandFailure(modifyCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
146146
}
147147

148148
@Test
149149
public void equals() {
150-
final EditCommand standardCommand = new EditCommand(INDEX_FIRST_PERSON, DESC_AMY);
150+
final ModifyCommand standardCommand = new ModifyCommand(INDEX_FIRST_PERSON, DESC_AMY);
151151

152152
// same values -> returns true
153153
EditPersonDescriptor copyDescriptor = new EditPersonDescriptor(DESC_AMY);
154-
EditCommand commandWithSameValues = new EditCommand(INDEX_FIRST_PERSON, copyDescriptor);
154+
ModifyCommand commandWithSameValues = new ModifyCommand(INDEX_FIRST_PERSON, copyDescriptor);
155155
assertTrue(standardCommand.equals(commandWithSameValues));
156156

157157
// same object -> returns true
@@ -164,10 +164,10 @@ public void equals() {
164164
assertFalse(standardCommand.equals(new ClearCommand()));
165165

166166
// different index -> returns false
167-
assertFalse(standardCommand.equals(new EditCommand(INDEX_SECOND_PERSON, DESC_AMY)));
167+
assertFalse(standardCommand.equals(new ModifyCommand(INDEX_SECOND_PERSON, DESC_AMY)));
168168

169169
// different descriptor -> returns false
170-
assertFalse(standardCommand.equals(new EditCommand(INDEX_FIRST_PERSON, DESC_BOB)));
170+
assertFalse(standardCommand.equals(new ModifyCommand(INDEX_FIRST_PERSON, DESC_BOB)));
171171
}
172172

173173
}

src/test/java/seedu/address/logic/parser/AddressBookParserTest.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@
1313

1414
import org.junit.jupiter.api.Test;
1515

16-
import seedu.address.logic.commands.AddCommand;
17-
import seedu.address.logic.commands.ClearCommand;
18-
import seedu.address.logic.commands.DeleteCommand;
19-
import seedu.address.logic.commands.EditCommand;
20-
import seedu.address.logic.commands.EditCommand.EditPersonDescriptor;
21-
import seedu.address.logic.commands.ExitCommand;
22-
import seedu.address.logic.commands.FindCommand;
23-
import seedu.address.logic.commands.HelpCommand;
24-
import seedu.address.logic.commands.ListCommand;
16+
import seedu.address.logic.commands.*;
17+
import seedu.address.logic.commands.ModifyCommand;
18+
import seedu.address.logic.commands.ModifyCommand.EditPersonDescriptor;
2519
import seedu.address.logic.parser.exceptions.ParseException;
2620
import seedu.address.model.person.NameContainsKeywordsPredicate;
2721
import seedu.address.model.person.Person;
@@ -57,9 +51,9 @@ public void parseCommand_delete() throws Exception {
5751
public void parseCommand_edit() throws Exception {
5852
Person person = new PersonBuilder().build();
5953
EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder(person).build();
60-
EditCommand command = (EditCommand) parser.parseCommand(EditCommand.COMMAND_WORD + " "
54+
ModifyCommand command = (ModifyCommand) parser.parseCommand(ModifyCommand.COMMAND_WORD + " "
6155
+ INDEX_FIRST_PERSON.getOneBased() + " " + PersonUtil.getEditPersonDescriptorDetails(descriptor));
62-
assertEquals(new EditCommand(INDEX_FIRST_PERSON, descriptor), command);
56+
assertEquals(new ModifyCommand(INDEX_FIRST_PERSON, descriptor), command);
6357
}
6458

6559
@Test

0 commit comments

Comments
 (0)