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.
Merge pull request #34 from ejnan/remove-prefixes
Remove unused prefixes
- Loading branch information
Showing
41 changed files
with
348 additions
and
1,159 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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
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_ADMISSION_DATE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_DOB; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_IC; | ||
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.logic.parser.CliSyntax.PREFIX_WARD; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import java.util.Collections; | ||
|
@@ -21,14 +22,11 @@ | |
import seedu.address.logic.Messages; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Address; | ||
import seedu.address.model.person.AdmissionDate; | ||
import seedu.address.model.person.Dob; | ||
import seedu.address.model.person.Email; | ||
import seedu.address.model.person.Ic; | ||
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.Ward; | ||
import seedu.address.model.tag.Tag; | ||
|
||
|
@@ -44,13 +42,14 @@ 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_IC + "I/C] " | ||
+ "[" + PREFIX_DOB + "DATE OF BIRTH] " | ||
+ "[" + PREFIX_WARD + "WARD] " | ||
+ "[" + PREFIX_ADMISSION_DATE + "ADMISSION DATE] " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " 1 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]"; | ||
+ PREFIX_IC + "T123456Q " | ||
+ PREFIX_DOB + "12/08/1999"; | ||
|
||
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; | ||
|
@@ -100,18 +99,14 @@ 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()); | ||
Ic updatedIc = editPersonDescriptor.getIc().orElse(personToEdit.getIc()); | ||
Dob updatedDob = editPersonDescriptor.getDob().orElse(personToEdit.getDob()); | ||
AdmissionDate updatedAdmissionDate = | ||
editPersonDescriptor.getAdmissionDate().orElse(personToEdit.getAdmissionDate()); | ||
Ward updatedWard = editPersonDescriptor.getWard().orElse(personToEdit.getWard()); | ||
|
||
return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, | ||
updatedTags, updatedDob, updatedIc, updatedAdmissionDate, updatedWard); | ||
return new Person(updatedName, updatedTags, updatedDob, updatedIc, updatedAdmissionDate, updatedWard); | ||
} | ||
|
||
@Override | ||
|
@@ -144,9 +139,6 @@ public String toString() { | |
*/ | ||
public static class EditPersonDescriptor { | ||
private Name name; | ||
private Phone phone; | ||
private Email email; | ||
private Address address; | ||
private Set<Tag> tags; | ||
private Ic ic; | ||
private Dob dob; | ||
|
@@ -161,9 +153,6 @@ public EditPersonDescriptor() {} | |
*/ | ||
public EditPersonDescriptor(EditPersonDescriptor toCopy) { | ||
setName(toCopy.name); | ||
setPhone(toCopy.phone); | ||
setEmail(toCopy.email); | ||
setAddress(toCopy.address); | ||
setTags(toCopy.tags); | ||
setDob(toCopy.dob); | ||
setIc(toCopy.ic); | ||
|
@@ -175,7 +164,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, ic, dob, admissionDate, ward, tags); | ||
} | ||
|
||
public void setName(Name name) { | ||
|
@@ -186,30 +175,6 @@ 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; | ||
} | ||
|
||
public Optional<Email> getEmail() { | ||
return Optional.ofNullable(email); | ||
} | ||
|
||
public void setAddress(Address address) { | ||
this.address = address; | ||
} | ||
|
||
public Optional<Address> getAddress() { | ||
return Optional.ofNullable(address); | ||
} | ||
|
||
/** | ||
* Sets {@code tags} to this object's {@code tags}. | ||
* A defensive copy of {@code tags} is used internally. | ||
|
@@ -263,9 +228,6 @@ 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) | ||
&& Objects.equals(ic, otherEditPersonDescriptor.ic) | ||
&& Objects.equals(dob, otherEditPersonDescriptor.dob) | ||
|
@@ -278,9 +240,6 @@ 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) | ||
.add("ic", ic) | ||
.add("dob", dob) | ||
|
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
Oops, something went wrong.