forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98f2a19
commit d1cef6c
Showing
21 changed files
with
134 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
//import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; | ||
|
||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
|
||
import seedu.address.commons.util.ToStringBuilder; | ||
|
@@ -23,13 +23,13 @@ public class AddCommand extends Command { | |
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " | ||
+ "Parameters: " | ||
+ PREFIX_NAME + "NAME " | ||
//+ PREFIX_PHONE + "PHONE " | ||
|
||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ PREFIX_NAME + "John Doe " | ||
//+ PREFIX_PHONE + "98765432 " | ||
|
||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_TAG + "friends " | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
//import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; | ||
|
||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
|
@@ -40,12 +40,12 @@ public class EditCommand extends Command { | |
+ "Existing values will be overwritten by the input values.\n" | ||
+ "Parameters: INDEX (must be a positive integer) " | ||
+ "[" + PREFIX_NAME + "NAME] " | ||
//+ "[" + PREFIX_PHONE + "PHONE] " | ||
|
||
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " 1 " | ||
//+ PREFIX_PHONE + "91234567 " | ||
|
||
+ PREFIX_EMAIL + "[email protected]"; | ||
|
||
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; | ||
|
@@ -96,7 +96,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript | |
assert personToEdit != null; | ||
|
||
Name updatedName = editPersonDescriptor.getName().orElse(personToEdit.getName()); | ||
//Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); | ||
|
||
Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); | ||
Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); | ||
Set<Tag> updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); | ||
|
@@ -134,7 +134,7 @@ public String toString() { | |
*/ | ||
public static class EditPersonDescriptor { | ||
private Name name; | ||
private Phone phone; | ||
|
||
private Email email; | ||
private Address address; | ||
private Set<Tag> tags; | ||
|
@@ -147,7 +147,7 @@ public EditPersonDescriptor() {} | |
*/ | ||
public EditPersonDescriptor(EditPersonDescriptor toCopy) { | ||
setName(toCopy.name); | ||
setPhone(toCopy.phone); | ||
|
||
setEmail(toCopy.email); | ||
setAddress(toCopy.address); | ||
setTags(toCopy.tags); | ||
|
@@ -157,7 +157,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { | |
* Returns true if at least one field is edited. | ||
*/ | ||
public boolean isAnyFieldEdited() { | ||
return CollectionUtil.isAnyNonNull(name, phone, email, address, tags); | ||
return CollectionUtil.isAnyNonNull(name, email, address, tags); | ||
} | ||
|
||
public void setName(Name name) { | ||
|
@@ -168,13 +168,9 @@ public Optional<Name> getName() { | |
return Optional.ofNullable(name); | ||
} | ||
|
||
public void setPhone(Phone phone) { | ||
this.phone = phone; | ||
} | ||
|
||
public Optional<Phone> getPhone() { | ||
return Optional.ofNullable(phone); | ||
} | ||
|
||
|
||
|
||
public void setEmail(Email email) { | ||
this.email = email; | ||
|
@@ -222,7 +218,7 @@ public boolean equals(Object other) { | |
|
||
EditPersonDescriptor otherEditPersonDescriptor = (EditPersonDescriptor) other; | ||
return Objects.equals(name, otherEditPersonDescriptor.name) | ||
&& Objects.equals(phone, otherEditPersonDescriptor.phone) | ||
|
||
&& Objects.equals(email, otherEditPersonDescriptor.email) | ||
&& Objects.equals(address, otherEditPersonDescriptor.address) | ||
&& Objects.equals(tags, otherEditPersonDescriptor.tags); | ||
|
@@ -232,7 +228,7 @@ public boolean equals(Object other) { | |
public String toString() { | ||
return new ToStringBuilder(this) | ||
.add("name", name) | ||
.add("phone", phone) | ||
|
||
.add("email", email) | ||
.add("address", address) | ||
.add("tags", tags) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; | ||
|
||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
|
||
|
@@ -28,8 +28,7 @@ public class CommandTestUtil { | |
|
||
public static final String VALID_NAME_AMY = "Amy Bee"; | ||
public static final String VALID_NAME_BOB = "Bob Choo"; | ||
public static final String VALID_PHONE_AMY = "11111111"; | ||
public static final String VALID_PHONE_BOB = "22222222"; | ||
|
||
public static final String VALID_EMAIL_AMY = "[email protected]"; | ||
public static final String VALID_EMAIL_BOB = "[email protected]"; | ||
public static final String VALID_ADDRESS_AMY = "Block 312, Amy Street 1"; | ||
|
@@ -39,8 +38,6 @@ public class CommandTestUtil { | |
|
||
public static final String NAME_DESC_AMY = " " + PREFIX_NAME + VALID_NAME_AMY; | ||
public static final String NAME_DESC_BOB = " " + PREFIX_NAME + VALID_NAME_BOB; | ||
public static final String PHONE_DESC_AMY = " " + PREFIX_PHONE + VALID_PHONE_AMY; | ||
public static final String PHONE_DESC_BOB = " " + PREFIX_PHONE + VALID_PHONE_BOB; | ||
public static final String EMAIL_DESC_AMY = " " + PREFIX_EMAIL + VALID_EMAIL_AMY; | ||
public static final String EMAIL_DESC_BOB = " " + PREFIX_EMAIL + VALID_EMAIL_BOB; | ||
public static final String ADDRESS_DESC_AMY = " " + PREFIX_ADDRESS + VALID_ADDRESS_AMY; | ||
|
@@ -49,7 +46,7 @@ public class CommandTestUtil { | |
public static final String TAG_DESC_HUSBAND = " " + PREFIX_TAG + VALID_TAG_HUSBAND; | ||
|
||
public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + "James&"; // '&' not allowed in names | ||
public static final String INVALID_PHONE_DESC = " " + PREFIX_PHONE + "911a"; // 'a' not allowed in phones | ||
public static final String INVALID_PHONE_DESC = " " + "911a"; // 'a' not allowed in phones | ||
public static final String INVALID_EMAIL_DESC = " " + PREFIX_EMAIL + "bob!yahoo"; // missing '@' symbol | ||
public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS; // empty string not allowed for addresses | ||
public static final String INVALID_TAG_DESC = " " + PREFIX_TAG + "hubby*"; // '*' not allowed in tags | ||
|
@@ -62,10 +59,10 @@ public class CommandTestUtil { | |
|
||
static { | ||
DESC_AMY = new EditPersonDescriptorBuilder().withName(VALID_NAME_AMY) | ||
.withPhone(VALID_PHONE_AMY).withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_AMY) | ||
.withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_AMY) | ||
.withTags(VALID_TAG_FRIEND).build(); | ||
DESC_BOB = new EditPersonDescriptorBuilder().withName(VALID_NAME_BOB) | ||
.withPhone(VALID_PHONE_BOB).withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB) | ||
.withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB) | ||
.withTags(VALID_TAG_HUSBAND, VALID_TAG_FRIEND).build(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.