java.lang.Object
edu.ntnu.idata1002.prosjekt2021.model.Section
public class Section
extends java.lang.Object
Represents a section.
A section is based on postalcodes.
Holds a list of patients and nurses.
-
Constructor Summary
Constructors Constructor Description Section(java.lang.String sectionName)
Creates a instance of Section. -
Method Summary
Modifier and Type Method Description void
addNurse(Nurse nurse)
Adding a given nurse to a list of nurses.void
addPatient(Patient patient)
Adding a new patient to a list of patients.java.util.List<Nurse>
getNurses()
Returns a list with all the nurses.java.util.List<Patient>
getPatients()
Returns a list with all the patients.java.util.ArrayList<java.lang.Integer>
getPostalCode()
Returns postcodes covered by a section.java.lang.String
getSectionName()
Returns this section name.void
removeNurse(Nurse nurse)
Removing a nurse, if nurse is in the list.void
removePatient(Patient patient)
Removing a patient, if patient is in the list.void
setPostalCode(java.util.ArrayList<java.lang.Integer> postalCode)
Sets a list of new postcodes to a section.void
setSectionName(java.lang.String sectionName)
Sets new section name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Section
public Section(java.lang.String sectionName)Creates a instance of Section.- Parameters:
sectionName
- name of the section.
-
-
Method Details
-
getSectionName
public java.lang.String getSectionName()Returns this section name.- Returns:
- this section name.
-
getPostalCode
public java.util.ArrayList<java.lang.Integer> getPostalCode()Returns postcodes covered by a section.- Returns:
- postcodes covered by a section.
-
setSectionName
public void setSectionName(java.lang.String sectionName)Sets new section name.- Parameters:
sectionName
- the new section name to be set.
-
setPostalCode
public void setPostalCode(java.util.ArrayList<java.lang.Integer> postalCode)Sets a list of new postcodes to a section.- Parameters:
postalCode
- new postcode to a section.
-
addPatient
Adding a new patient to a list of patients. Only a patient with unique socialSecurityNumber will be added.- Parameters:
patient
- a new patient.
-
addNurse
Adding a given nurse to a list of nurses.- Parameters:
nurse
- the nurse to be added to the list of nurses..- Throws:
java.lang.IllegalArgumentException
-
removePatient
Removing a patient, if patient is in the list.- Parameters:
patient
- patient to be removed.- Throws:
RemoveException
- if the patient was not removed
-
removeNurse
Removing a nurse, if nurse is in the list.- Parameters:
nurse
- nurse to be removed.- Throws:
RemoveException
- if the nurse was not removed.
-
getPatients
Returns a list with all the patients.- Returns:
- a list with all the patients.
-
getNurses
Returns a list with all the nurses.- Returns:
- a list with all the nurses.
-