*/
public class Fuel {
/**
- * {@link FuelType}
+ * {@link FuelType FuelType}
*/
public final FuelType FUEL_TYPE;
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;
}
* 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 {
/**
*/
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;
* 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;
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());
/**
* 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
/**
* 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
* 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),
*
* @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),
}
return result.toArray(new FuelStation[0]); // Change to LargeFuelStation if required
}
+
/**
* Get the FuelStation with the highest price
*
*
* @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;
}
* 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),
*
* @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),
* 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 {
/**
* 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),
*
* @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),