Commit c49cf453 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Combined part 1 and 2, added TODOs

parent b2c8b716
......@@ -7,7 +7,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
org.eclipse.jdt.core.compiler.compliance=12
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.source=12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tdt4100-v2020</groupId>
<artifactId>ord-2019</artifactId>
<artifactId>ord2019</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
......@@ -50,7 +50,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<configuration></configuration>
<configuration>
<excludePackageNames>ord2019.lf.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
......
package ord2019.part1;
/**
* A doctor has the capacity to treat one patient at a time.
*/
public class Doctor {
// TODO: Internal variables go here
/**
* @return the patient this doctor is treating, or null if s/he isn't currently
* treating any patient.
*/
public Patient getPatient() { // 1a
return null; // TODO
}
/**
* @return true if this doctor is currently treating a patient, otherwise false.
*/
public boolean isAvailable() { // 1a
return false; // TODO
}
/**
* Sets the patient that this doctor is treating, use null to indicate s/he
* isn't currently treating any patient.
*
* @param patient
*/
public void setPatient(final Patient patient) { // 1a
// TODO
}
}
\ No newline at end of file
package ord2019.part1;
public class Patient {
}
\ No newline at end of file
package ord2019.part2;
package ord2019.part1and2;
/**
* A doctor has the capacity to treat one patient at a time. The doctor as a
......@@ -7,15 +7,15 @@ package ord2019.part2;
*/
public class Doctor {
// Internal variables go here // 2b
// TODO: Neccessary decarations
/**
* Initialise this doctor with a set of competencies.
*
* @param competencies
*/
public Doctor( /* TODO */ ) { // 2b
// TODO 2b: Constructor parameter list and body
public Doctor() {
}
/**
......@@ -27,16 +27,17 @@ public class Doctor {
* @param patient
* @return the ratio of the patient's conditions that this doctor can treat.
*/
public double canTreat(final Patient patient) { // 2b
return 0.0d; // TODO
public double canTreat(final Patient patient) {
// TODO 2b
return 0.0d;
}
/**
* "Treats" the patient by removing all the patient's conditions that this
* doctor can treat.
*/
public void treat() { // 2b
// TODO
public void treat() {
// TODO 2b
}
/**
......@@ -44,14 +45,16 @@ public class Doctor {
* treating any patient.
*/
public Patient getPatient() {
return null; // TODO
// TODO 1a
return null;
}
/**
* @return true if this doctor is currently treating a patient, otherwise false.
*/
public boolean isAvailable() {
return false; // TODO
// TODO 1a
return false;
}
/**
......@@ -61,6 +64,6 @@ public class Doctor {
* @param patient
*/
public void setPatient(final Patient patient) {
// TODO
// TODO 1a
}
}
\ No newline at end of file
}
package ord2019.part2;
package ord2019.part1and2;
public class Patient {
// Add fields, constructors, and methods here: // 2a
// Support iteration // 2a
// TODO 2a: Add fields, constructors, and methods here
/**
* Indicates if this patient has conditions that needs to be treated.
......@@ -11,8 +10,9 @@ public class Patient {
* @return true if this patient has conditions that needs to be treated, false
* otherwise.
*/
public boolean requiresTreatment() { // 2a
return false; // TODO
public boolean requiresTreatment() {
// TODO 2a
return false;
}
}
\ No newline at end of file
package ord2019.part1;
package ord2019.part1and2;
import java.util.Collection;
import java.util.function.Predicate;
......@@ -10,7 +10,7 @@ import java.util.function.Predicate;
*/
public class TreatmentUnit {
// Internal variables go here: // 1b
// TODO 1b: Internal variables go here
/**
* Adds a doctor and makes sure s/he starts treating a patient, if one is
......@@ -18,15 +18,16 @@ public class TreatmentUnit {
*
* @param doctor
*/
public void addDoctor(final Doctor doctor) { // 1b
// TODO
public void addDoctor(final Doctor doctor) {
// TODO 1b
}
/**
* @return the currently available doctors
*/
public Collection<Doctor> getAvailableDoctors() { // 1b
return null; // TODO
public Collection<Doctor> getAvailableDoctors() {
// TODO 1b
return null;
}
/**
......@@ -36,16 +37,17 @@ public class TreatmentUnit {
*
* @param patient
*/
public void addPatient(final Patient patient) { // 1b
// TODO
public void addPatient(final Patient patient) {
// TODO 1b
}
/**
* @param pred the predicate that the doctor must satisfy
* @return some doctor satisfying the predicate
*/
public Doctor getDoctor(final Predicate<Doctor> pred) { // 1b
return null; // TODO
public Doctor getDoctor(final Predicate<Doctor> pred) {
// TODO 1b
return null;
}
/**
......@@ -55,8 +57,9 @@ public class TreatmentUnit {
* @return the doctor treating the provided patient, or null, of the patient
* isn't currently being treated
*/
public Doctor getDoctor(final Patient patient) { // 1b
return null; // TODO
public Doctor getDoctor(final Patient patient) {
// TODO 1b
return null;
}
/**
......@@ -64,8 +67,9 @@ public class TreatmentUnit {
*
* @return the patients not currently being treated.
*/
public Collection<Patient> getWaitingPatients() { // 1b
return null; // TODO
public Collection<Patient> getWaitingPatients() {
// TODO 1b
return null;
}
/**
......@@ -74,8 +78,9 @@ public class TreatmentUnit {
* @param doctor the doctor for which a patient to treat should be found
* @return true if a patient for the provided doctor was found, false otherwise.
*/
private boolean startTreatment(final Doctor doctor) { // 1c
return false; // TODO
private boolean startTreatment(final Doctor doctor) {
// TODO 1c
return false;
}
/**
......@@ -85,8 +90,9 @@ public class TreatmentUnit {
* @param patient the patient for which a treating doctor should be found.
* @return true if a doctor for the provided patient was found, false otherwise.
*/
private boolean startTreatment(final Patient patient) { // 1c
return false; // TODO
private boolean startTreatment(final Patient patient) {
// TODO 1c
return false;
}
/**
......@@ -96,7 +102,7 @@ public class TreatmentUnit {
*
* @param doctor the doctor that has finished treating his/her patient.
*/
public void treatmentFinished(final Doctor doctor) { // 1c
// TODO
public void treatmentFinished(final Doctor doctor) {
// TODO 1c
}
}
package ord2019.part2;
package ord2019.part1and2;
import org.junit.Before;
import org.junit.Test;
......
package ord2019.part2;
import java.util.Collection;
import java.util.function.Predicate;
/**
* A class for managing a set of doctors and the patients they're treating. When
* doctors or patients arrive, it is made sure that patients are treated as soon
* as possible.
*/
public class TreatmentUnit {
// Internal variables go here: // 1b
/**
* Adds a doctor and makes sure s/he starts treating a patient, if one is waiting.
* @param doctor
*/
public void addDoctor(final Doctor doctor) { // 1b
}
/**
* @return the currently available doctors
*/
public Collection<Doctor> getAvailableDoctors() { // 1b
return null;
}
/**
* Adds a patient to this treatment unit, and makes sure treatment starts if any doctor is available.
* Otherwise the patient is queued for treatment when a doctor becomes available.
* @param patient
*/
public void addPatient(final Patient patient) { // 1b
}
/**
* @param pred the predicate that the doctor must satisfy
* @return some doctor satisfying the predicate
*/
public Doctor getDoctor(final Predicate<Doctor> pred) { // 1b
return null;
}
/**
* Find the doctor, if any, that treats the provided patient.
* @param patient
* @return the doctor treating the provided patient, or null, of the patient isn't currently being treated
*/
public Doctor getDoctor(final Patient patient) { // 1b
return null;
}
/**
* Find all patients that are not currently being treated.
* @return the patients not currently being treated.
*/
public Collection<Patient> getWaitingPatients() { // 1b
return null;
}
/**
* Finds a waiting patient and sets him/her as the provided doctor's patient.
* @param doctor the doctor for which a patient to treat should be found
* @return true if a patient for the provided doctor was found, false
* otherwise.
*/
private boolean startTreatment(final Doctor doctor) { // 1c
return false;
}
/**
* Finds an available doctor for the provided patient, and sets that doctor to
* treat the patient.
* @param patient the patient for which a treating doctor should be found.
* @return true if a doctor for the provided patient was found, false
* otherwise.
*/
private boolean startTreatment(final Patient patient) { // 1c
return false;
}
/**
* Removes the link between doctor and patient, after treatment is finished.
* Since the patient is fully treated, s/he is removed from this treatment
* unit.
* Also ensure the doctor starts treating another patient.
* @param doctor the doctor that has finished treating his/her patient.
*/
public void treatmentFinished(final Doctor doctor) { // 1c
}
}
package ord2019.part5;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment