From 34b4ecd98a3d0bd49ee38b206014ef5efaf5d253 Mon Sep 17 00:00:00 2001 From: Robin Cheney Date: Wed, 12 Nov 2025 09:09:37 +0100 Subject: [PATCH] corrected javadoc syntax for @see and added comments for getter and setter methods in Fuel.java --- .../diejungsvondertanke/tankstelle/Fuel.java | 32 ++++++++++- .../tankstelle/FuelStation.java | 55 +++++++++---------- .../tankstelle/LargeFuelStation.java | 6 +- .../diejungsvondertanke/tankstelle/Main.java | 5 +- .../tankstelle/MediumFuelStation.java | 6 +- .../diejungsvondertanke/tankstelle/Size.java | 6 +- .../tankstelle/SmallFuelStation.java | 6 +- 7 files changed, 73 insertions(+), 43 deletions(-) diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/Fuel.java b/src/main/java/de/diejungsvondertanke/tankstelle/Fuel.java index e1a3de3..c7e60e0 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/Fuel.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/Fuel.java @@ -6,7 +6,7 @@ package de.diejungsvondertanke.tankstelle; */ public class Fuel { /** - * {@link FuelType} + * {@link FuelType FuelType} */ public final FuelType FUEL_TYPE; @@ -41,26 +41,56 @@ public class Fuel { this.CAPACITY = capacity; } + /** + * Getter method + * + * @return {@link FuelType FuelType} of this {@link Fuel Fuel} + */ public FuelType getFuelType() { return FUEL_TYPE; } + /** + * Getter method + * + * @return {@link #stored_amount stored amount of fuel} + */ public float getStored_amount() { return stored_amount; } + /** + * Set new stored amount of fuel + * + * @param stored_amount New stored amount of fuel + */ public void setStored_amount(float stored_amount) { this.stored_amount = stored_amount; } + /** + * Getter method + * + * @return {@link #CAPACITY Maximum fuel capacity} + */ public int getCapacity() { return CAPACITY; } + /** + * Getter method + * + * @return {@link #price price in € / L fuel} + */ public float getPrice() { return price; } + /** + * Set new price in € / L fuel + * + * @param price New price in € / L fuel + */ public void setPrice(float price) { this.price = price; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStation.java index 102f499..babe1bb 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStation.java @@ -6,12 +6,9 @@ import de.diejungsvondertanke.tankstelle.error.NoSuchFuelTypeError; * Abstract class. * All fuel station subtypes inherit from this class. * - * @see {@link LargeFuelStation - * LargeFuelStation} - * @see {@link MediumFuelStation - * MediumFuelStation} - * @see {@link SmallFuelStation - * SmallFuelStation} + * @see LargeFuelStation + * @see MediumFuelStation + * @see SmallFuelStation */ abstract class FuelStation { /** @@ -19,14 +16,13 @@ abstract class FuelStation { */ private byte number_of_employees; /** - * {@link Fuel} types and -amounts + * {@link Fuel Fuel} types and -amounts */ public Fuel[] fuels; /** - * The {@link Size} of a fuel station. Is more or less decorative, because you - * can infer - * the size from the fuel station's type + * The {@link Size Size} of a fuel station. Is more or less decorative, because + * you can infer the size from the fuel station's type */ private Size size; @@ -34,29 +30,30 @@ abstract class FuelStation { * Protected superconstructor for fuel stations * * @param number_of_employees Number of employees working at this fuel station - * @param size {@link Size} of the fuel station (see {@link Size} - * enum) - * @param fuels Array of {@link Fuel}s of this fuel station - * @see {@link LargeFuelStation LargeFuelStation} - * @see {@link MediumFuelStation MediumFuelStation} - * @see {@link SmallFuelStation SmallFuelStation} + * @param size {@link Size Size} of the fuel station (see + * {@link Size Size} enum) + * @param fuels Array of {@link Fuel Fuel}s of this fuel station + * @see LargeFuelStation + * @see MediumFuelStation + * @see SmallFuelStation */ protected FuelStation(byte number_of_employees, Size size, Fuel[] fuels) { this.number_of_employees = number_of_employees; this.size = size; this.fuels = fuels; } + /** * Set a new fuel amount for a specific type of fuel for this fuel station * - * @param type The {@link FuelType} to change - * @param new_amound The new fuel amound + * @param type The {@link FuelType FuelType} to change + * @param new_amount The new fuel amount * @throws NoSuchFuelTypeError This Error is thrown on the attempt to choose a * fuel type from a fuel station * which the fuel station does not have */ - public void set_stored_amount(float new_amount, FuelType type)throws NoSuchFuelTypeError { - for (Fuel i : fuels) { + public void set_stored_amount(float new_amount, FuelType type) throws NoSuchFuelTypeError { + for (Fuel i : fuels) { if (i.FUEL_TYPE == type) { i.setStored_amount(new_amount); return; @@ -64,19 +61,21 @@ abstract class FuelStation { throw new NoSuchFuelTypeError("This fuel station does not have fuel of the given type"); } } + /** - * Add or subtract from a fuel amount for a specific type of fuel for this fuel station + * Add or subtract from a fuel amount for a specific type of fuel for this fuel + * station * - * @param type The {@link FuelType} to change - * @param new_amound The aound of fuel that is added or subtracted + * @param type The {@link FuelType FuelType} to change + * @param new_amount The amount of fuel that is added or subtracted * @throws NoSuchFuelTypeError This Error is thrown on the attempt to choose a * fuel type from a fuel station * which the fuel station does not have */ - public void add_stored_amount(float new_amount, FuelType type)throws NoSuchFuelTypeError , ArithmeticException { - for (Fuel i : fuels) { + public void add_stored_amount(float new_amount, FuelType type) throws NoSuchFuelTypeError, ArithmeticException { + for (Fuel i : fuels) { if (i.FUEL_TYPE == type) { - if (new_amount + i.getStored_amount() < 0){ + if (new_amount + i.getStored_amount() < 0) { throw new ArithmeticException("Fuel amound can't be negativ"); } i.setStored_amount(new_amount + i.getStored_amount()); @@ -89,7 +88,7 @@ abstract class FuelStation { /** * Set a new price for a specific type of fuel for this fuel station * - * @param fuel_type The {@link FuelType} to change + * @param fuel_type The {@link FuelType FuelTypes} to change * @param price The new price per litre * @throws NoSuchFuelTypeError This Error is thrown on the attempt to choose a * fuel type from a fuel station @@ -108,7 +107,7 @@ abstract class FuelStation { /** * Get the price for a specific type of fuel for this fuel station * - * @param fuel_type The {@link FuelType} to get + * @param fuel_type The {@link FuelType FuelType} to get * @throws NoSuchFuelTypeError This Error is thrown on the attempt to choose a * fuel type from a fuel station * which the fuel station does not have diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java index a8b3d65..cc7a78f 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/LargeFuelStation.java @@ -13,7 +13,7 @@ public class LargeFuelStation extends FuelStation { * Constructs large {@link FuelStation fuel station}s * * @param supermarket_company The company managing the integrated supermarket - * @see {@link #supermarket_company} + * @see #supermarket_company */ public LargeFuelStation(String supermarket_company) { super((byte) 4, Size.LARGE, new Fuel[] { new Fuel(FuelType.SUPER, 8000f, 0f, 16000), @@ -29,8 +29,8 @@ public class LargeFuelStation extends FuelStation { * * @param supermarket_company The company managing the integrated supermarket * @param number_of_employees Number of employees - * @see {@link #supermarket_company} - * @see {@link FuelStation#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, 0f, 16000), diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/Main.java b/src/main/java/de/diejungsvondertanke/tankstelle/Main.java index 53b3e4f..1662546 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/Main.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/Main.java @@ -72,6 +72,7 @@ public class Main { } return result.toArray(new FuelStation[0]); // Change to LargeFuelStation if required } + /** * Get the FuelStation with the highest price * @@ -80,11 +81,11 @@ public class Main { * * @return a FuelStation (all of type {@link FuelStation}) */ - public static FuelStation getHighestPrise (FuelType fuelType) throws NoSuchFuelTypeError { + public static FuelStation getHighestPrise(FuelType fuelType) throws NoSuchFuelTypeError { float highestPrice = fuelStations[0].get_price(fuelType); FuelStation HighestStation = fuelStations[0]; for (FuelStation fuelStation : fuelStations) { - if (fuelStation.get_price(fuelType) > highestPrice){ + if (fuelStation.get_price(fuelType) > highestPrice) { highestPrice = fuelStation.get_price(fuelType); HighestStation = fuelStation; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java index 9c890fa..f4d96d3 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/MediumFuelStation.java @@ -13,7 +13,7 @@ public class MediumFuelStation extends FuelStation { * Constructs medium {@link FuelStation fuel station}s * * @param retail_space m² of retail space - * @see {@link #retail_space} + * @see #retail_space retail_space */ public MediumFuelStation(float retail_space) { super((byte) 2, Size.MEDIUM, new Fuel[] { new Fuel(FuelType.SUPER, 6000f, 0f, 12000), @@ -28,8 +28,8 @@ public class MediumFuelStation extends FuelStation { * * @param retail_space m² of retail space * @param number_of_employees Number of employees - * @see {@link #retail_space} - * @see {@link FuelStation#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, 0f, 12000), diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/Size.java b/src/main/java/de/diejungsvondertanke/tankstelle/Size.java index e9c4c18..958627b 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/Size.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/Size.java @@ -6,9 +6,9 @@ package de.diejungsvondertanke.tankstelle; * can infer * the size from the fuel station's type * - * @see {@link LargeFuelStation} - * @see {@link MediumFuelStation} - * @see {@link SmallFuelStation} + * @see LargeFuelStation + * @see MediumFuelStation + * @see SmallFuelStation */ public enum Size { /** diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java index ceb96d6..98ab3b0 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/SmallFuelStation.java @@ -13,7 +13,7 @@ public class SmallFuelStation extends FuelStation { * Constructs small {@link FuelStation fuel station}s * * @param number_of_vending_machines Number of drink vending machines - * @see {@link #number_of_vending_machines} + * @see #number_of_vending_machines */ public SmallFuelStation(short number_of_vending_machines) { super((byte) 1, Size.SMALL, new Fuel[] { new Fuel(FuelType.SUPER, 4000f, 0f, 8000), @@ -26,8 +26,8 @@ public class SmallFuelStation extends FuelStation { * * @param number_of_vending_machines Number of drink vending machines * @param number_of_employees Number of employees - * @see {@link #number_of_vending_machines} - * @see {@link FuelStation#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, 0f, 8000), -- 2.43.0