Skip to content

Commit

Permalink
Update Person.java
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzongteo committed Oct 14, 2017
1 parent 0874d45 commit 437214e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ public class Person implements ReadOnlyPerson {
private ObjectProperty<Phone> phone;
private ObjectProperty<Email> email;
private ObjectProperty<Address> address;
private ObjectProperty<Photo> photo;

private ObjectProperty<UniqueTagList> tags;

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

// protect internal tags from changes in the arg list
this.tags = new SimpleObjectProperty<>(new UniqueTagList(tags));
}
Expand All @@ -44,7 +47,7 @@ public Person(Name name, Phone phone, Email email, Address address, Set<Tag> tag
*/
public Person(ReadOnlyPerson source) {
this(source.getName(), source.getPhone(), source.getEmail(), source.getAddress(),
source.getTags());
source.getPhoto(), source.getTags());
}

public void setName(Name name) {
Expand Down Expand Up @@ -103,6 +106,16 @@ public Address getAddress() {
return address.get();
}

public void setPhoto(Photo photo) {
this.photo.set(photo);
}

@Override
public ObjectProperty<Photo> photoProperty() { return photo; }

@Override
public Photo getPhoto() { return photo.get(); }

/**
* Returns an immutable tag set, which throws {@code UnsupportedOperationException}
* if modification is attempted.
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/seedu/address/model/person/ReadOnlyPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public interface ReadOnlyPerson {
Email getEmail();
ObjectProperty<Address> addressProperty();
Address getAddress();
ObjectProperty<Photo> photoProperty();
Photo getPhoto();
ObjectProperty<UniqueTagList> tagProperty();
Set<Tag> getTags();
boolean containsTags(List<String> tags);
Expand Down Expand Up @@ -49,6 +51,8 @@ default String getAsText() {
.append(getEmail())
.append(" Address: ")
.append(getAddress())
.append(" Image: ")
.append(getPhoto())
.append(" Tags: ");
getTags().forEach(builder::append);
return builder.toString();
Expand Down

0 comments on commit 437214e

Please sign in to comment.