Skip to content
Snippets Groups Projects
Commit 221b585b authored by Jens Tingstad's avatar Jens Tingstad
Browse files

fixed remove method from HospitalClient

parent 8d79d36e
Branches master
No related tags found
No related merge requests found
package Facilities;
import Clients.Person;
import java.util.ArrayList;
import java.util.List;
......@@ -26,6 +28,9 @@ public class Hospital {
public List<Department> getDepartments(){
return departments;
}
public List<Person> getDepartment(List<Person> list){
return list;
}
public void addDepartment(Department department){
departments.add(department);
......
......@@ -3,17 +3,29 @@ package Facilities;
import Clients.Patient;
import Employees.*;
/**
* Mainclient, holds and manipulates hospital objects.
*/
public class HospitalClient {
private HospitalClient(){
}
/**
* Main method creating a new hospital named "Gjøvik Sykehus" and fills it with data
* from HospitalTestData
* @param args
*/
public static void main(String[] args) {
Hospital hospital = new Hospital("Gjøvik Sykehus");
HospitalTestData hospitalTestData = new HospitalTestData(hospital);
System.out.println(hospital.departments);
System.out.println(hospital.getDepartments());
System.out.println(hospital.departments.get(1).getEmployees().get(1));
hospital.departments.get(1).removePerson(hospital.departments.get(1).getEmployees().get(1) );
System.out.println(hospital.departments.get(1).getEmployees().get(1));
}
}
......@@ -6,6 +6,9 @@ import Employees.GeneralPractitioner;
import Employees.Nurse;
import Employees.Surgeon;
/**
* A class to fill hospital objects with testdata
*/
public class HospitalTestData {
private HospitalTestData() {
// not called
......@@ -18,28 +21,29 @@ public class HospitalTestData {
*/
public static void fillRegisterWithTestData(final Hospital hospital) {
// Add some departments
Department emergency = new Department("Akutten");
hospital.addDepartment(emergency);
emergency.addEmployee(new Employee("Odd Even", "Primtallet", ""));
emergency.addEmployee(new Employee("Huppasahn", "DelFinito", ""));
emergency.addEmployee(new Employee("Rigmor", "Mortis", ""));
emergency.addEmployee(new GeneralPractitioner("Inco", "Gnito", ""));
emergency.addEmployee(new Surgeon("Inco", "Gnito", ""));
emergency.addEmployee(new Nurse("Nina", "Teknologi", ""));
emergency.addEmployee(new Nurse("Ove", "Ralt", ""));
emergency.addPatient(new Patient("Inga", "Lykke", ""));
emergency.addPatient(new Patient("Ulrik", "Smål", ""));
emergency.getEmployees().add(new Employee("Odd Even", "Primtallet", ""));
emergency.getEmployees().add(new Employee("Huppasahn", "DelFinito", ""));
emergency.getEmployees().add(new Employee("Rigmor", "Mortis", ""));
emergency.getEmployees().add(new GeneralPractitioner("Inco", "Gnito", ""));
emergency.getEmployees().add(new Surgeon("Inco", "Gnito", ""));
emergency.getEmployees().add(new Nurse("Nina", "Teknologi", ""));
emergency.getEmployees().add(new Nurse("Ove", "Ralt", ""));
emergency.getPatients().add(new Patient("Inga", "Lykke", ""));
emergency.getPatients().add(new Patient("Ulrik", "Smål", ""));
hospital.getDepartments().add(emergency);
Department childrenPolyclinic = new Department("Barn poliklinikk");
hospital.addDepartment(childrenPolyclinic);
childrenPolyclinic.addEmployee(new Employee("Salti", "Kaffen", ""));
childrenPolyclinic.addEmployee(new Employee("Nidel V.", "Elvefølger", ""));
childrenPolyclinic.addEmployee(new Employee("Anton", "Nym", ""));
childrenPolyclinic.addEmployee(new GeneralPractitioner("Gene", "Sis", ""));
childrenPolyclinic.addEmployee(new Surgeon("Nanna", "Na", ""));
childrenPolyclinic.addEmployee(new Nurse("Nora", "Toriet", ""));
childrenPolyclinic.addPatient(new Patient("Hans", "Omvar", ""));
childrenPolyclinic.addPatient(new Patient("Laila", "La", ""));
childrenPolyclinic.addPatient(new Patient("Jøran", "Drebli", ""));
childrenPolyclinic.getEmployees().add(new Employee("Salti", "Kaffen", ""));
childrenPolyclinic.getEmployees().add(new Employee("Nidel V.", "Elvefølger", ""));
childrenPolyclinic.getEmployees().add(new Employee("Anton", "Nym", ""));
childrenPolyclinic.getEmployees().add(new GeneralPractitioner("Gene", "Sis", ""));
childrenPolyclinic.getEmployees().add(new Surgeon("Nanna", "Na", ""));
childrenPolyclinic.getEmployees().add(new Nurse("Nora", "Toriet", ""));
childrenPolyclinic.getPatients().add(new Patient("Hans", "Omvar", ""));
childrenPolyclinic.getPatients().add(new Patient("Laila", "La", ""));
childrenPolyclinic.getPatients().add(new Patient("Jøran", "Drebli", ""));
hospital.getDepartments().add(childrenPolyclinic);
}
}
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment