From: Robin Cheney Date: Sun, 16 Nov 2025 08:56:31 +0000 (+0100) Subject: Removed constructor overloads because according to project specifications the number... X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;h=93e4451431e9608fdcec8eeaf8a26cbffb3033ac;p=tankstelle.git Removed constructor overloads because according to project specifications the number of employees is a constant value and therefore declared a static final value for this --- diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java index 7d19b2c..05aba13 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java @@ -4,6 +4,10 @@ package de.diejungsvondertanke.tankstelle; * Large {@link FuelStation fuel station} */ public class LargeFuelStation extends FuelStation { + /** + * Number of employees + */ + public static final byte NUMBER_OF_EMPLOYEES = 4; /** * The company managing the integrated supermarket */ @@ -16,24 +20,7 @@ public class LargeFuelStation extends FuelStation { * @see #supermarket_company */ public LargeFuelStation(String supermarket_company) { - super((byte) 4, Size.LARGE, new Fuel[] { new Fuel(FuelType.SUPER, 8000f, 1.7f, 16000), - new Fuel(FuelType.SUPER_E10, 8000f, 1.7f, 16000), - new Fuel(FuelType.DIESEL, 8000f, 1.7f, 16000), - new Fuel(FuelType.PREMIUM_DIESEL, 8000f, 1.7f, 16000), - new Fuel(FuelType.AUTOGAS, 8000f, 1.7f, 16000) }); - this.supermarket_company = supermarket_company; - } - - /** - * Constructs large {@link FuelStation fuel station}s - * - * @param supermarket_company The company managing the integrated supermarket - * @param number_of_employees Number of employees - * @see #supermarket_company - * @see FuelStation#number_of_employees - */ - public LargeFuelStation(String supermarket_company, byte number_of_employees) { - super(number_of_employees, Size.LARGE, new Fuel[] { new Fuel(FuelType.SUPER, 8000f, 1.7f, 16000), + super(NUMBER_OF_EMPLOYEES, Size.LARGE, new Fuel[] { new Fuel(FuelType.SUPER, 8000f, 1.7f, 16000), new Fuel(FuelType.SUPER_E10, 8000f, 1.7f, 16000), new Fuel(FuelType.DIESEL, 8000f, 1.7f, 16000), new Fuel(FuelType.PREMIUM_DIESEL, 8000f, 1.7f, 16000), diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java index 9b7bd55..bbabcfa 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java @@ -4,6 +4,10 @@ package de.diejungsvondertanke.tankstelle; * Medium {@link FuelStation fuel station} */ public class MediumFuelStation extends FuelStation { + /** + * Number of employees + */ + public static final byte NUMBER_OF_EMPLOYEES = 2; /** * m² of retail space */ @@ -16,23 +20,7 @@ public class MediumFuelStation extends FuelStation { * @see #retail_space retail_space */ public MediumFuelStation(float retail_space) { - super((byte) 2, Size.MEDIUM, new Fuel[] { new Fuel(FuelType.SUPER, 6000f, 1.7f, 12000), - new Fuel(FuelType.SUPER_E10, 6000f, 1.7f, 12000), - new Fuel(FuelType.PREMIUM_DIESEL, 6000f, 1.7f, 12000), - new Fuel(FuelType.AUTOGAS, 6000f, 1.7f, 12000) }); - this.retail_space = retail_space; - } - - /** - * Constructs medium {@link FuelStation fuel station}s - * - * @param retail_space m² of retail space - * @param number_of_employees Number of employees - * @see #retail_space - * @see FuelStation#number_of_employees - */ - public MediumFuelStation(float retail_space, byte number_of_employees) { - super(number_of_employees, Size.MEDIUM, new Fuel[] { new Fuel(FuelType.SUPER, 6000f, 1.7f, 12000), + super(NUMBER_OF_EMPLOYEES, Size.MEDIUM, new Fuel[] { new Fuel(FuelType.SUPER, 6000f, 1.7f, 12000), new Fuel(FuelType.SUPER_E10, 6000f, 1.7f, 12000), new Fuel(FuelType.PREMIUM_DIESEL, 6000f, 1.7f, 12000), new Fuel(FuelType.AUTOGAS, 6000f, 1.7f, 12000) }); diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java index 96f379a..6f660b6 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java @@ -5,32 +5,23 @@ package de.diejungsvondertanke.tankstelle; */ public class SmallFuelStation extends FuelStation { /** - * Number of drink vending machines + * Number of employees */ - private short number_of_vending_machines; + public static final byte NUMBER_OF_EMPLOYEES = 1; /** - * Constructs small {@link FuelStation fuel station}s - * - * @param number_of_vending_machines Number of drink vending machines - * @see #number_of_vending_machines + * Number of drink vending machines */ - public SmallFuelStation(short number_of_vending_machines) { - super((byte) 1, Size.SMALL, new Fuel[] { new Fuel(FuelType.SUPER, 4000f, 1.68f, 8000), - new Fuel(FuelType.DIESEL, 4000f, 1.7f, 8000) }); - this.number_of_vending_machines = number_of_vending_machines; - } + private short number_of_vending_machines; /** * Constructs small {@link FuelStation fuel station}s * * @param number_of_vending_machines Number of drink vending machines - * @param number_of_employees Number of employees * @see #number_of_vending_machines - * @see FuelStation#number_of_employees */ - public SmallFuelStation(short number_of_vending_machines, byte number_of_employees) { - super(number_of_employees, Size.SMALL, new Fuel[] { new Fuel(FuelType.SUPER, 4000f, 1.68f, 8000), + public SmallFuelStation(short number_of_vending_machines) { + super(NUMBER_OF_EMPLOYEES, Size.SMALL, new Fuel[] { new Fuel(FuelType.SUPER, 4000f, 1.68f, 8000), new Fuel(FuelType.DIESEL, 4000f, 1.7f, 8000) }); this.number_of_vending_machines = number_of_vending_machines; }