Skip to content

Commit

Permalink
Edit method header comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjohntan committed Oct 10, 2024
1 parent b96b92a commit 8784aec
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,29 @@ public boolean isSamePerson(Person otherPerson) {
}

/**
* Returns true if both person have the same email address.
* This is to check for duplicates in emails in the contact list.
* Checks for duplicates in emails in the contact list.
* @param otherPerson The Person object to compare against.
* @return True if both persons have the same email address.
*/
public boolean hasSameEmail(Person otherPerson) {
return otherPerson != null && otherPerson.getEmail().equals(this.getEmail());
}

/**
* Returns true if two contacts share the same phone number.
* Checks for duplicates in phone numbers in the contact list.
* @param otherPerson The Person object to compare against.
* @return True if both persons have the same phone number.
*/
public boolean hasSamePhoneNumber(Person otherPerson) {
return otherPerson != null && otherPerson.getPhone().equals(this.getPhone());
}

/**
* Returns true if two contacts are considered as duplicates.
* This is to avoid adding duplicate contact in the contact list.
*
* Checks for duplicated contact information between Person instances.
* This is to avoid adding duplicate contacts in the contact list.
* Checked fields: name, phone, email.
* @param otherPerson The Person object to compare against.
* @return True if two contacts are considered as duplicates.
*/
public boolean hasDuplicateInfo(Person otherPerson) {
return this.isSamePerson(otherPerson)
Expand Down

0 comments on commit 8784aec

Please sign in to comment.