forked from AY2324S2-CS2103T-T08-1/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-jsonadaptedperson-optional
- Loading branch information
Showing
4 changed files
with
131 additions
and
11 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
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,34 +1,63 @@ | ||
package seedu.address.testutil; | ||
|
||
|
||
import seedu.address.model.person.Address; | ||
import seedu.address.model.person.Allergies; | ||
import seedu.address.model.person.BloodType; | ||
import seedu.address.model.person.Condition; | ||
import seedu.address.model.person.Country; | ||
import seedu.address.model.person.DateOfAdmission; | ||
import seedu.address.model.person.DateOfBirth; | ||
import seedu.address.model.person.Diagnosis; | ||
import seedu.address.model.person.Email; | ||
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Nric; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.Sex; | ||
import seedu.address.model.person.Status; | ||
import seedu.address.model.person.Symptom; | ||
|
||
/** | ||
* A utility class to help with building Person objects. | ||
*/ | ||
public class PersonBuilder { | ||
|
||
// Mandatory fields | ||
public static final String DEFAULT_NRIC = "T1234567B"; | ||
public static final String DEFAULT_NAME = "Amy Bee"; | ||
public static final String DEFAULT_PHONE = "85355255"; | ||
public static final String DEFAULT_EMAIL = "[email protected]"; | ||
public static final String DEFAULT_DOB = "1998-07-03"; | ||
public static final String DEFAULT_SEX = "M"; | ||
// Data fields | ||
public static final String DEFAULT_ADDRESS = "123, Jurong West Ave 6, #08-111"; | ||
public static final String DEFAULT_ALLERGIES = "Peanuts"; | ||
public static final String[] DEFAULT_BLOODTYPE = {"A", "POSITIVE"}; | ||
public static final String DEFAULT_COUNTRY = "Singapore"; | ||
// Medical history | ||
public static final String DEFAULT_CONDITION = "High blood pressure"; | ||
public static final String DEFAULT_DOA = "2024-01-01"; | ||
public static final String DEFAULT_DIAGNOSIS = "Runny nose"; | ||
public static final String DEFAULT_STATUS = "HEALTHY"; | ||
public static final String DEFAULT_SYMPTOM = "Sneezing, sniffing"; | ||
|
||
// Mandatory fields | ||
private Nric nric; | ||
private Name name; | ||
private Phone phone; | ||
private Address address; | ||
private DateOfBirth dateOfBirth; | ||
private Sex sex; | ||
// Data fields | ||
private Address address; | ||
private Allergies allergies; | ||
private BloodType bloodType; | ||
private Country country; | ||
private Email email; | ||
//Medical history | ||
private Condition condition; | ||
private DateOfAdmission dateOfAdmission; | ||
private Diagnosis diagnosis; | ||
private Status status; | ||
private Symptom symptom; | ||
|
||
/** | ||
* Creates a {@code PersonBuilder} with the default details. | ||
|
@@ -40,21 +69,41 @@ public PersonBuilder() { | |
address = new Address(DEFAULT_ADDRESS); | ||
dateOfBirth = new DateOfBirth(DEFAULT_DOB); | ||
sex = new Sex(DEFAULT_SEX); | ||
|
||
address = new Address(DEFAULT_ADDRESS); | ||
allergies = new Allergies(DEFAULT_ALLERGIES); | ||
bloodType = new BloodType(DEFAULT_BLOODTYPE[0], DEFAULT_BLOODTYPE[1]); | ||
country = new Country(DEFAULT_COUNTRY); | ||
email = new Email(DEFAULT_EMAIL); | ||
|
||
condition = new Condition(DEFAULT_CONDITION); | ||
dateOfAdmission = new DateOfAdmission(DEFAULT_DOA); | ||
diagnosis = new Diagnosis(DEFAULT_DIAGNOSIS); | ||
status = new Status(DEFAULT_STATUS); | ||
symptom = new Symptom(DEFAULT_SYMPTOM); | ||
} | ||
|
||
/** | ||
* Initializes the PersonBuilder with the data of {@code personToCopy}. | ||
*/ | ||
public PersonBuilder(Person personToCopy) { | ||
//TODO: Add the missing fields | ||
nric = personToCopy.getNric(); | ||
name = personToCopy.getName(); | ||
phone = personToCopy.getPhone(); | ||
address = personToCopy.getAddress(); | ||
dateOfBirth = personToCopy.getDateOfBirth(); | ||
sex = personToCopy.getSex(); | ||
|
||
address = personToCopy.getAddress(); | ||
allergies = personToCopy.getAllergies(); | ||
bloodType = personToCopy.getBloodType(); | ||
country = personToCopy.getCountry(); | ||
email = personToCopy.getEmail(); | ||
|
||
condition = personToCopy.getCondition(); | ||
dateOfAdmission = personToCopy.getDateOfAdmission(); | ||
diagnosis = personToCopy.getDiagnosis(); | ||
status = personToCopy.getStatus(); | ||
symptom = personToCopy.getSymptom(); | ||
} | ||
|
||
/** | ||
|
@@ -64,6 +113,7 @@ public PersonBuilder withNric(String nric) { | |
this.nric = new Nric(nric); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Name} of the {@code Person} that we are building. | ||
*/ | ||
|
@@ -72,6 +122,13 @@ public PersonBuilder withName(String name) { | |
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withPhone(String phone) { | ||
this.phone = new Phone(phone); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Address} of the {@code Person} that we are building. | ||
|
@@ -84,8 +141,8 @@ public PersonBuilder withAddress(String address) { | |
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withPhone(String phone) { | ||
this.phone = new Phone(phone); | ||
public PersonBuilder withDateOfBirth(String dateOfBirth) { | ||
this.dateOfBirth = new DateOfBirth(dateOfBirth); | ||
return this; | ||
} | ||
|
||
|
@@ -105,6 +162,70 @@ public PersonBuilder withStatus(String status) { | |
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withEmail(String email) { | ||
this.email = new Email(email); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withCountry(String country) { | ||
this.country = new Country(country); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withAllergies(String allergies) { | ||
this.allergies = new Allergies(allergies); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withBloodType(String[] bloodType) { | ||
this.bloodType = new BloodType(bloodType[0], bloodType[1]); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withCondition(String condition) { | ||
this.condition = new Condition(condition); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withDateOfAdmission(String dateOfAdmission) { | ||
this.dateOfAdmission = new DateOfAdmission(dateOfAdmission); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withDiagnosis(String diagnosis) { | ||
this.diagnosis = new Diagnosis(diagnosis); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Phone} of the {@code Person} that we are building. | ||
*/ | ||
public PersonBuilder withSymptom(String symptom) { | ||
this.symptom = new Symptom(symptom); | ||
return this; | ||
} | ||
|
||
public Person build() { | ||
return new Person(nric, name, phone, address, dateOfBirth, sex, status); | ||
} | ||
|