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.
- Loading branch information
NatLeong
committed
Apr 1, 2024
1 parent
92b39be
commit 2e21d92
Showing
1 changed file
with
40 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,34 +30,32 @@ public class PersonBuilder { | |
// Data fields | ||
public static final String DEFAULT_ADDRESS = "123, Jurong West Ave 6, #08-111"; | ||
public static final String DEFAULT_STATUS = "HEALTHY"; | ||
/* | ||
|
||
public static final String DEFAULT_EMAIL = "[email protected]"; | ||
public static final String DEFAULT_ALLERGIES = "Peanuts"; | ||
public static final String[] DEFAULT_BLOODTYPE = {"A", "POSITIVE"}; | ||
public static final String DEFAULT_BLOODTYPE = "A+"; | ||
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_SYMPTOM = "Sneezing, sniffing"; | ||
*/ | ||
|
||
// Mandatory fields | ||
private Nric nric; | ||
private Name name; | ||
private Phone phone; | ||
private DateOfBirth dateOfBirth; | ||
private Sex sex; | ||
// Data fields | ||
private Address address; | ||
private Status status; | ||
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; | ||
|
||
/** | ||
|
@@ -71,18 +69,14 @@ public PersonBuilder() { | |
dateOfBirth = new DateOfBirth(DEFAULT_DOB); | ||
sex = new Sex(DEFAULT_SEX); | ||
status = new Status(DEFAULT_STATUS); | ||
|
||
/* | ||
allergies = new Allergies(DEFAULT_ALLERGIES); | ||
bloodType = new BloodType(DEFAULT_BLOODTYPE[0], DEFAULT_BLOODTYPE[1]); | ||
bloodType = new BloodType(DEFAULT_BLOODTYPE); | ||
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); | ||
symptom = new Symptom(DEFAULT_SYMPTOM); | ||
*/ | ||
} | ||
|
||
/** | ||
|
@@ -97,7 +91,6 @@ public PersonBuilder(Person personToCopy) { | |
address = personToCopy.getAddress(); | ||
status = personToCopy.getStatus(); | ||
|
||
/* | ||
address = personToCopy.getAddress(); | ||
allergies = personToCopy.getAllergies(); | ||
bloodType = personToCopy.getBloodType(); | ||
|
@@ -108,7 +101,7 @@ public PersonBuilder(Person personToCopy) { | |
dateOfAdmission = personToCopy.getDateOfAdmission(); | ||
diagnosis = personToCopy.getDiagnosis(); | ||
symptom = personToCopy.getSymptom(); | ||
*/ | ||
|
||
} | ||
|
||
/** | ||
|
@@ -236,14 +229,39 @@ public PersonBuilder withSymptom(String symptom) { | |
*/ | ||
public Person build() { | ||
Person p = new Person(nric, name, phone, address, dateOfBirth, sex, status); | ||
p.setEmail(email); | ||
p.setCountry(country); | ||
p.setAllergies(allergies); | ||
p.setBloodType(bloodType); | ||
p.setCondition(condition); | ||
p.setDateOfAdmission(dateOfAdmission); | ||
p.setDiagnosis(diagnosis); | ||
p.setSymptom(symptom); | ||
|
||
if (email != null) { | ||
p.setEmail(email); | ||
} | ||
|
||
if (country != null) { | ||
p.setCountry(country); | ||
} | ||
|
||
if (allergies != null) { | ||
p.setAllergies(allergies); | ||
} | ||
|
||
if (bloodType != null) { | ||
p.setBloodType(bloodType); | ||
} | ||
|
||
if (condition != null) { | ||
p.setCondition(condition); | ||
} | ||
|
||
if (dateOfAdmission != null) { | ||
p.setDateOfAdmission(dateOfAdmission); | ||
} | ||
|
||
if (diagnosis != null) { | ||
p.setDiagnosis(diagnosis); | ||
} | ||
|
||
if (symptom != null) { | ||
p.setSymptom(symptom); | ||
} | ||
|
||
return p; | ||
} | ||
} |