Skip to content

Commit

Permalink
Add comment field in person class
Browse files Browse the repository at this point in the history
  • Loading branch information
Judy1x4 committed Oct 10, 2024
1 parent df99ec4 commit ddcdf8b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ public class Person {
// Data fields
private final Address address;
private final Set<Tag> tags = new HashSet<>();
private final Comment comment;

/**
* Every field must be present and not null.
*/
public Person(Name name, Phone phone, Email email, Address address, Set<Tag> tags) {
requireAllNonNull(name, phone, email, address, tags);
public Person(Name name, Phone phone, Email email, Address address, Set<Tag> tags, Comment comment) {
requireAllNonNull(name, phone, email, address, tags, comment);
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
this.tags.addAll(tags);
this.comment = comment;
}

public Name getName() {
Expand All @@ -53,6 +55,10 @@ public Address getAddress() {
return address;
}

public Comment getComment() {
return comment;
}

/**
* Returns an immutable tag set, which throws {@code UnsupportedOperationException}
* if modification is attempted.
Expand Down Expand Up @@ -94,13 +100,14 @@ public boolean equals(Object other) {
&& phone.equals(otherPerson.phone)
&& email.equals(otherPerson.email)
&& address.equals(otherPerson.address)
&& tags.equals(otherPerson.tags);
&& tags.equals(otherPerson.tags)
&& comment.equals(otherPerson.comment);
}

@Override
public int hashCode() {
// use this method for custom fields hashing instead of implementing your own
return Objects.hash(name, phone, email, address, tags);
return Objects.hash(name, phone, email, address, tags, comment);
}

@Override
Expand All @@ -111,6 +118,7 @@ public String toString() {
.add("email", email)
.add("address", address)
.add("tags", tags)
.add("comment", comment)
.toString();
}

Expand Down

0 comments on commit ddcdf8b

Please sign in to comment.