From 57e395ee087cb6070f858fadeebd80183bd0cdb5 Mon Sep 17 00:00:00 2001 From: Robin Cheney Date: Mon, 1 Dec 2025 10:01:56 +0100 Subject: [PATCH] Javadoc formatting --- .../controllers/FuelStationUIController.java | 10 +++- .../controllers/NewStationTabController.java | 9 +++- .../controllers/OverviewTabController.java | 51 +++---------------- .../controllers/PriceTabController.java | 9 +++- .../controllers/ResultTabController.java | 9 +++- .../controllers/SearchTabController.java | 9 +++- .../controllers/StockTabController.java | 9 +++- .../UnderstaffedTabController.java | 9 +++- .../tankstelle/core/Fuel.java | 7 ++- .../tankstelle/core/FuelStation.java | 13 ++++- .../tankstelle/core/FuelType.java | 11 ++-- .../tankstelle/core/LargeFuelStation.java | 8 ++- .../tankstelle/core/MediumFuelStation.java | 9 +++- .../tankstelle/core/Size.java | 4 +- .../tankstelle/core/SmallFuelStation.java | 8 ++- .../tankstelle/ui/FuelRow.java | 7 ++- .../tankstelle/ui/JFX.java | 19 ++++++- 17 files changed, 128 insertions(+), 73 deletions(-) diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/FuelStationUIController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/FuelStationUIController.java index 64c8fde..941ac96 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/FuelStationUIController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/FuelStationUIController.java @@ -63,17 +63,25 @@ public class FuelStationUIController { private UnderstaffedTabController understaffedTabController; /** - * Automatically called initialize() function. + *

+ * Automatically called {@code initialize()} function. + *

* + *

* This is the "main" UI setup routine. For timing reasons, this will/must load * every subtab manually to get the controller object and set the * {@link FuelStationUIController} controller in every subtab controller * element. + *

* + *

* If not done correctly, using the controller in the subtabs WILL FAIL. + *

* + *

* USING THE CONTROLLER OBJECT INSIDE THE {@code initialize()} FUNCTION OF THE * SUBTABS WILL NOT WORK AND WILL ALWAYS BE {@code null} DUE TO TIMING ISSUES + *

*/ @FXML public void initialize() { diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java index 3904e1b..097ff56 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java @@ -25,12 +25,17 @@ public class NewStationTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java index d78ccb6..0d47488 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java @@ -10,8 +10,6 @@ import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.fxml.FXML; -import javafx.scene.Node; -import javafx.scene.Parent; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; @@ -42,12 +40,17 @@ public class OverviewTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; @@ -72,22 +75,9 @@ public class OverviewTabController { @FXML public void refresh() { table.getItems().clear(); - // ObservableList list = FXCollections.observableArrayList(); - // table.getItems().add(new FuelRow("TestStation", "TestType", "Diesel", 123, - - // 999, 1.23f)); - // System.out.println("On FX thread? " + Platform.isFxApplicationThread()); for (FuelStation station : Main.fuelStations) { for (Fuel f : station.fuels) { - // System.out.println("Row: " + - // parentController.getDisplayName(station) + " | " + - // station.getClass().getSimpleName() + " | " + - // f.FUEL_TYPE + " | " + - // f.getStored_amount() + " | " + - // f.CAPACITY + " | " + - // f.getPrice()); - table.getItems().add( new FuelRow( parentController.getDisplayName(station), @@ -96,34 +86,7 @@ public class OverviewTabController { f.getStored_amount(), f.CAPACITY, f.getPrice())); - // System.out.println("Processed " + f.toString()); } } - // System.out.print(list); - // table.setItems(list); } - - /** - * This is just a debugging function. Do not use in a production environment - * - * @param node A displayed {@link Node} (i. e. from one of the Tabs) to display - * a tree-like inner structure for - * @param depth max. recursion depth - */ - public static void printNodeTree(Node node, int depth) { - // Indentation - String indent = " ".repeat(depth); - - // Print this node - System.out.println(indent + node.getClass().getSimpleName() - + (node.getId() != null ? " [id=" + node.getId() + "]" : "")); - - // If the node is a Parent, get its children and recurse - if (node instanceof Parent parent) { - for (Node child : parent.getChildrenUnmodifiable()) { - printNodeTree(child, depth + 1); - } - } - } - } \ No newline at end of file diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/PriceTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/PriceTabController.java index c429999..8405c73 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/PriceTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/PriceTabController.java @@ -20,12 +20,17 @@ public class PriceTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java index 97dd4fc..950242c 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java @@ -28,12 +28,17 @@ public class ResultTabController { } /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parentController) { this.parentController = parentController; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/SearchTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/SearchTabController.java index bf97366..2a192b1 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/SearchTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/SearchTabController.java @@ -17,12 +17,17 @@ public class SearchTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/StockTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/StockTabController.java index 732077c..eaddaa4 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/StockTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/StockTabController.java @@ -26,12 +26,17 @@ public class StockTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/UnderstaffedTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/UnderstaffedTabController.java index 4488ba9..0f47e7f 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/UnderstaffedTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/UnderstaffedTabController.java @@ -21,12 +21,17 @@ public class UnderstaffedTabController { private FuelStationUIController parentController; /** + *

* For timing reasons this is a common method for every controller that is for a * tab (not to confuse with the main window controller - * {@link FuelStationUIController}). This passes the controller object from the + * {@link FuelStationUIController}). + *

+ *

+ * This passes the controller object from the * main controller to the controllers for the individual tabs as fields. * Necessary, if you need to access any methods from the main controller, which - * is much likely the case + * is much likely the case. + *

*/ public void setParentController(FuelStationUIController parent) { this.parentController = parent; diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/Fuel.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/Fuel.java index 4a25d1a..0c2e972 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/Fuel.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/Fuel.java @@ -1,8 +1,13 @@ package de.diejungsvondertanke.tankstelle.core; /** - * A fuel object. Contains fuel type, price per litre, stored fuel amount and + *

+ * A fuel object. + *

+ *

+ * Contains fuel type, price per litre, stored fuel amount and * storage capacity for this fuel + *

* * @author Robin Cheney */ diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java index cc05f98..93ffab3 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java @@ -27,8 +27,13 @@ public abstract class FuelStation { public Fuel[] fuels; /** - * The {@link Size Size} of a fuel station. Is more or less decorative, because + *

+ * 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; @@ -262,6 +267,12 @@ public abstract class FuelStation { throw new NoSuchFuelTypeError("This fuel station does not have fuel of the given type"); } + /** + * This function is used to get a generic simplified class name for display + * purposes to indicate the size of this fuel station + * + * @return {@code null} because this method should be overridden in subclasses + */ public String getSimpleName() { return null; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelType.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelType.java index 71c0016..0e254a2 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelType.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelType.java @@ -15,8 +15,13 @@ public enum FuelType { */ DIESEL("Diesel"), /** - * If you want to feel like saving the planet: Now with at most 10% ethanol in + *

+ * If you want to feel like saving the planet: + *

+ *

+ * Now with at most 10% ethanol in * your gasoline + *

*/ SUPER_E10("Super E10"), /** @@ -41,8 +46,4 @@ public enum FuelType { public String toString() { return name; } - - public static FuelType toEnum(String name) { - return FuelType.valueOf(name); - } } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java index cea33aa..76199c6 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java @@ -33,7 +33,7 @@ public class LargeFuelStation extends FuelStation { } /** - * Getter method + * Get the name of the company running the integrated supermarket * * @return the name of the company running the integrated supermarket * @@ -43,6 +43,12 @@ public class LargeFuelStation extends FuelStation { return supermarket_company; } + /** + * This function is used to get a generic simplified class name for display + * purposes to indicate the size of this fuel station + * + * @return the simplified name for a {@link LargeFuelStation large fuel station} + */ public String getSimpleName() { return "large fuel station"; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java index 7a15b9f..c4fe99f 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java @@ -32,7 +32,7 @@ public class MediumFuelStation extends FuelStation { } /** - * Getter method + * Get the retail space in m² of this fuel station * * @return retail space in m² * @@ -42,6 +42,13 @@ public class MediumFuelStation extends FuelStation { return retail_space; } + /** + * This function is used to get a generic simplified class name for display + * purposes to indicate the size of this fuel station + * + * @return the simplified name for a {@link MediumFuelStation medium fuel + * station} + */ public String getSimpleName() { return "medium fuel station"; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/Size.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/Size.java index 461dc11..08fa726 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/Size.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/Size.java @@ -2,9 +2,7 @@ package de.diejungsvondertanke.tankstelle.core; /** * The size of a {@link FuelStation fuel station}. Is more or less decorative, - * because you - * can infer - * the size from the fuel station's type + * because you can infer the size from the fuel station's type * * @see LargeFuelStation * @see MediumFuelStation diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java index e8002d6..d48a71c 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java @@ -31,7 +31,7 @@ public class SmallFuelStation extends FuelStation { } /** - * Getter method + * Get the number of drink vending machines this fuel station has * * @return the number of drink vending machines this fuel station has * @@ -41,6 +41,12 @@ public class SmallFuelStation extends FuelStation { return number_of_vending_machines; } + /** + * This function is used to get a generic simplified class name for display + * purposes to indicate the size of this fuel station + * + * @return the simplified name for a {@link SmallFuelStation small fuel station} + */ public String getSimpleName() { return "small fuel station"; } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java b/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java index 8243111..3187477 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java @@ -1,8 +1,13 @@ package de.diejungsvondertanke.tankstelle.ui; /** - * Glorified record class for the data rows from the table. This is only used + *

+ * Glorified record class for the data rows from the table. + *

+ *

+ * This is only used * for the table in the "Overview" tab in the ui + *

* * @author Robin Cheney */ diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/ui/JFX.java b/src/main/java/de/diejungsvondertanke/tankstelle/ui/JFX.java index 0a1cf8a..e5a75f9 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/ui/JFX.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/ui/JFX.java @@ -2,7 +2,6 @@ package de.diejungsvondertanke.tankstelle.ui; import java.io.IOException; -// import de.diejungsvondertanke.tankstelle.controllers.ControllerRegistry; import de.diejungsvondertanke.tankstelle.controllers.FuelStationUIController; import javafx.application.Application; import javafx.fxml.FXMLLoader; @@ -41,8 +40,15 @@ public class JFX extends Application { } /** + *

* Set the keybinds and set the default closing behaviour to run the quit() - * function + * function. + *

+ * + *

+ * Yes, as of now, this is just for the fun of it and does not serve any + * practical purposes. + *

*/ private void initializeKeybinds() { // Override the default close behaviour @@ -84,16 +90,25 @@ public class JFX extends Application { }); } + /** + * Exit the program with code 0 and call {@link #quit} + */ void exit() { quit(); System.exit(0); } + /** + * Exit the program with code {@code status} and call {@link #quit} + */ void exit(int status) { quit(); System.exit(status); } + /** + * Internal function. Just to say goodbye. That's all. + */ private void quit() { System.out.println("Exiting program, have a nice day :)"); } -- 2.43.0