From bcebce2a6a44c5d3b3ae0a1deb03680831ddf8c9 Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Tue, 19 Nov 2024 16:10:44 +0100 Subject: [PATCH 1/3] total pain --- .../CO2-Daten-Projekt-V2/src/FillTable.java | 219 +++++++++--------- .../classes/com/example/SystemInfo.class | Bin 561 -> 0 bytes Code/ost/_10_steuerrechner/pom.xml | 51 ++++ .../src/main/java/com/example/App.java | 38 +++ .../java/com/example/PrimaryController.java | 12 + .../java/com/example/SecondaryController.java | 12 + .../src/main/java/module-info.java | 7 + .../main/resources/com/example/primary.fxml | 69 ++++++ .../main/resources/com/example/secondary.fxml | 16 ++ .../target/classes/com/example/App.class | Bin 0 -> 1946 bytes .../com/example/PrimaryController.class | Bin 0 -> 575 bytes .../com/example/SecondaryController.class | Bin 0 -> 577 bytes .../target/classes/com/example/primary.fxml | 69 ++++++ .../target/classes/com/example/secondary.fxml | 16 ++ .../target/classes/module-info.class | Bin 0 -> 231 bytes 15 files changed, 402 insertions(+), 107 deletions(-) delete mode 100644 Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class create mode 100644 Code/ost/_10_steuerrechner/pom.xml create mode 100644 Code/ost/_10_steuerrechner/src/main/java/com/example/App.java create mode 100644 Code/ost/_10_steuerrechner/src/main/java/com/example/PrimaryController.java create mode 100644 Code/ost/_10_steuerrechner/src/main/java/com/example/SecondaryController.java create mode 100644 Code/ost/_10_steuerrechner/src/main/java/module-info.java create mode 100644 Code/ost/_10_steuerrechner/src/main/resources/com/example/primary.fxml create mode 100644 Code/ost/_10_steuerrechner/src/main/resources/com/example/secondary.fxml create mode 100644 Code/ost/_10_steuerrechner/target/classes/com/example/App.class create mode 100644 Code/ost/_10_steuerrechner/target/classes/com/example/PrimaryController.class create mode 100644 Code/ost/_10_steuerrechner/target/classes/com/example/SecondaryController.class create mode 100644 Code/ost/_10_steuerrechner/target/classes/com/example/primary.fxml create mode 100644 Code/ost/_10_steuerrechner/target/classes/com/example/secondary.fxml create mode 100644 Code/ost/_10_steuerrechner/target/classes/module-info.class diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java index 5dfd4b4..6b2fc05 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java @@ -1,115 +1,120 @@ public class FillTable { - // #region Constants - private static final String[] START_TIMES = { - "7:45", "8:35", "9:40", "10:30", "11:20", "12:10", "12:50", - "13:35", "14:25", "15:15", "16:15", "17:05" - }; + // #region Constants + private static final String[] START_TIMES = { + "7:45", "8:35", "9:40", "10:30", "11:20", "12:10", "12:50", + "13:35", "14:25", "15:15", "16:15", "17:05" + }; - private static final String[] END_TIMES = { - "8:30", "9:20", "10:25", "11:15", "12:05", "12:50", "13:30", - "14:20", "15:10", "16:10", "17:00", "17:50" - }; + private static final String[] END_TIMES = { + "8:30", "9:20", "10:25", "11:15", "12:05", "12:50", "13:30", + "14:20", "15:10", "16:10", "17:00", "17:50" + }; - // #region Helper Methods - private static void fillTable(String[] teacherShortNames, String day, String[] startTime, String[] endTime, - int roomIndex) { - int dayIndex = getDayIndex(day); - for (int i = 0; i < teacherShortNames.length && i < startTime.length && i < endTime.length; i++) { - Teacher teacher = new Teacher(teacherShortNames[i]); // Initialize Teacher with shortform - App.timeTable[roomIndex][dayIndex][i] = new Lesson(roomIndex, teacher.getName(), startTime[i], endTime[i], - day); - } - } - - private static int getDayIndex(String day) { - switch (day) { - case "Monday": - return 0; - case "Tuesday": - return 1; - case "Wednesday": - return 2; - case "Thursday": - return 3; - case "Friday": - return 4; - default: - return -1; - } - } - - // #region Fill 37 - static void fill37TimeTable() { - int roomIndex = 0; - fillTable(new String[] { "Hm", "Hm", "Hi", "Hm", "Hm", "Lunch", "Bd", "Gi", "Gi", "Ts", "Ts", "" }, - "Monday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Ts", "Ts", "Ts", "Ts", "Le", "Lunch", "Lunch", "Fh", "Fh", "Fh", "Fh", "" }, - "Tuesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Lu", "Lu", "Lu", "Lu", "Cg", "Cg", "Lunch", "Se", "Se", "Se", "Se", "" }, - "Wednesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Gi", "Gi", "Ba", "Ba", "Ba", "Lunch", "Bd", "Du", "Lz", "Lz" }, - "Thursday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Kp", "KP", "Or", "Vt", "Vt", "Lunch", "Lunch", "Du", "Du", "Du", "", "" }, - "Friday", START_TIMES, END_TIMES, roomIndex); - } - - // #region Fill 38 - static void fill38TimeTable() { - int roomIndex = 1; - fillTable(new String[] { "Bz", "Bz", "Bz", "Bz", "Bz", "Lunch", "Lunch", "Hn", "Hn", "Bu", "Hn", "Hn" }, - "Monday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Kg", "Kg", "Eh", "Re", "Re", "Lunch", "Lunch", "Bt", "Kh", "Kh", "", "" }, - "Tuesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Cg", "Cg", "Cg", "Cg", "Es", "Lunch", "Lunch", "Cg", "Cg", "", "", "" }, - "Wednesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Do", "Do", "Gr", "Gr", "Or", "Lunch", "Lunch", "Bu", "Bu", "Zu", "", "" }, - "Thursday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "", "Hu", "Ge", "Eh", "Eh", "Bu", "Lunch", "Eh", "Eh", "", "", "" }, - "Friday", START_TIMES, END_TIMES, roomIndex); - } - - // #region Fill 39 - static void fill39TimeTable() { - int roomIndex = 2; - fillTable(new String[] { "Bd", "Bd", "Bd", "Bd", "Bd", "Lunch", "Lunch", "Lu", "Lu", "Lu", "Lu", "" }, - "Monday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Do", "Do", "Zu", "Zu", "Zu", "Lunch", "Lunch", "Se", "Se", "Se", "Se", "" }, - "Tuesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Cg", "Cg", "Cg", "Cg", "Bu", "Lunch", "Lunch", "Gi", "Gi", "Gi", "Gi", "" }, - "Wednesday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Bd", "Bd", "Bd", "Bd", "Or", "Lunch", "Lunch", "Le", "Le", "Le", "", "" }, - "Thursday", START_TIMES, END_TIMES, roomIndex); - fillTable(new String[] { "Gi", "Gi", "Gr", "Gr", "Gi", "Lunch", "Lunch", "Hi", "Hi", "Hi", "", "" }, - "Friday", START_TIMES, END_TIMES, roomIndex); - } - - static boolean isBreak(int intHour, int intMinute) { - // Check if the time is between 7 AM and 5 PM - if (intHour >= 7 && intHour <= 17) { - // Check if the time falls between any lesson start and end times - for (int i = 0; i < START_TIMES.length; i++) { - // Split the start and end times into hours and minutes - String[] startTime = START_TIMES[i].split(":"); - String[] endTime = END_TIMES[i].split(":"); - - int startHour = Integer.parseInt(startTime[0]); - int startMinute = Integer.parseInt(startTime[1]); - int endHour = Integer.parseInt(endTime[0]); - int endMinute = Integer.parseInt(endTime[1]); - - // Check if the given time is during the current lesson - if ((intHour > startHour || (intHour == startHour && intMinute >= startMinute)) && - (intHour < endHour || (intHour == endHour && intMinute < endMinute))) { - return false; // It's not a break, it's during a lesson + // #region Helper Methods + private static void fillTable(String[] teacherShortNames, String day, String[] startTime, String[] endTime, + int roomIndex) { + int dayIndex = getDayIndex(day); + for (int i = 0; i < teacherShortNames.length && i < startTime.length && i < endTime.length; i++) { + Teacher teacher = new Teacher(teacherShortNames[i]); // Initialize Teacher with shortform + App.timeTable[roomIndex][dayIndex][i] = new Lesson(roomIndex, teacher.getName(), startTime[i], + endTime[i], + day); } - } - return true; // If no lessons match, it must be a break } - return false; // Time is outside of the school hours (7 AM to 6 PM roughly) - } + private static int getDayIndex(String day) { + switch (day) { + case "Monday": + return 0; + case "Tuesday": + return 1; + case "Wednesday": + return 2; + case "Thursday": + return 3; + case "Friday": + return 4; + default: + return -1; + } + } - static String whatBreakIsIt(int intHour, int intMinute, int intDay) { - return "No Break"; // If no break is found, return "No Break" - } + // #region Fill 37 + static void fill37TimeTable() { + int roomIndex = 0; + fillTable(new String[] { "Hm", "Hm", "Hi", "Hm", "Hm", "Lunch", "Bd", "Gi", "Gi", "Ts", "Ts", "" }, + "Monday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Ts", "Ts", "Ts", "Ts", "Le", "Lunch", "Lunch", "Fh", "Fh", "Fh", "Fh", "" }, + "Tuesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Lu", "Lu", "Lu", "Lu", "Cg", "Cg", "Lunch", "Se", "Se", "Se", "Se", "" }, + "Wednesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Gi", "Gi", "Ba", "Ba", "Ba", "Lunch", "Bd", "Du", "Lz", "Lz" }, + "Thursday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Kp", "KP", "Or", "Vt", "Vt", "Lunch", "Lunch", "Du", "Du", "Du", "", "" }, + "Friday", START_TIMES, END_TIMES, roomIndex); + } + + // #region Fill 38 + static void fill38TimeTable() { + int roomIndex = 1; + fillTable(new String[] { "Bz", "Bz", "Bz", "Bz", "Bz", "Lunch", "Lunch", "Hn", "Hn", "Bu", "Hn", "Hn" }, + "Monday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Kg", "Kg", "Eh", "Re", "Re", "Lunch", "Lunch", "Bt", "Kh", "Kh", "", "" }, + "Tuesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Cg", "Cg", "Cg", "Cg", "Es", "Lunch", "Lunch", "Cg", "Cg", "", "", "" }, + "Wednesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Do", "Do", "Gr", "Gr", "Or", "Lunch", "Lunch", "Bu", "Bu", "Zu", "", "" }, + "Thursday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "", "Hu", "Ge", "Eh", "Eh", "Bu", "Lunch", "Eh", "Eh", "", "", "" }, + "Friday", START_TIMES, END_TIMES, roomIndex); + } + + // #region Fill 39 + static void fill39TimeTable() { + int roomIndex = 2; + fillTable(new String[] { "Bd", "Bd", "Bd", "Bd", "Bd", "Lunch", "Lunch", "Lu", "Lu", "Lu", "Lu", "" }, + "Monday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Do", "Do", "Zu", "Zu", "Zu", "Lunch", "Lunch", "Se", "Se", "Se", "Se", "" }, + "Tuesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Cg", "Cg", "Cg", "Cg", "Bu", "Lunch", "Lunch", "Gi", "Gi", "Gi", "Gi", "" }, + "Wednesday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Bd", "Bd", "Bd", "Bd", "Or", "Lunch", "Lunch", "Le", "Le", "Le", "", "" }, + "Thursday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Gi", "Gi", "Gr", "Gr", "Gi", "Lunch", "Lunch", "Hi", "Hi", "Hi", "", "" }, + "Friday", START_TIMES, END_TIMES, roomIndex); + } + + static boolean isBreak(int intHour, int intMinute) { + // Check if the time is between 7 AM and 5 PM + if (intHour >= 7 && intHour <= 17) { + // Check if the time falls between any lesson start and end times + for (int i = 0; i < START_TIMES.length; i++) { + // Split the start and end times into hours and minutes + String[] startTime = START_TIMES[i].split(":"); + String[] endTime = END_TIMES[i].split(":"); + + int startHour = Integer.parseInt(startTime[0]); + int startMinute = Integer.parseInt(startTime[1]); + int endHour = Integer.parseInt(endTime[0]); + int endMinute = Integer.parseInt(endTime[1]); + + // Check if the given time is during the current lesson + if ((intHour > startHour || (intHour == startHour && intMinute >= startMinute)) && + (intHour < endHour || (intHour == endHour && intMinute < endMinute))) { + return false; // It's not a break, it's during a lesson + } + } + return true; // If no lessons match, it must be a break + } + + return false; // Time is outside of the school hours (7 AM to 6 PM roughly) + } + + static String whatBreakIsIt(int intHour, int intMinute, int intDay) { + boolean isABreak = false; + for (int i = 0; i < END_TIMES.length; i++) { + + } + return "No Break"; // If no break is found, return "No Break" + } } diff --git a/Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class b/Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class deleted file mode 100644 index 487f8e1ef68812d4c9105ba77a7d5fed29e78421..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 561 zcmZut%TB^j5Iw`IP>LWT;%niCfD5{GfpKGEV$!GyhJC3Qyo9!-6as&xD~$_3z>hM{ zZBaCKGjr$MbLPy<$LHHSfHNFxND=Ce@0wz1yVHpYse5PV|!tn6Wbe^ zw}Y{8LPG9bdNRBqq+9JiA#>?J2pwq@3}lfblr8Cro4Gp>!M#102tw8J9edKZ1F7mY zm-MfUM^6raZCVh`kYqhP-FugF4-l&_$Ho;JEXAu*1>|j?z?a%1(QU>bS zY>m*H|fPaX$^tr+^YCg?qX9ysDks;$eLQ+5;)C*Yg$ z-NBL6tvG62nVgAp_Vfk$XMUuhb5!4oTI6WN1kNR{3fMxK5hZR$Kg_OHUQvBw + 4.0.0 + com.example + _10_steuerrechner + 1.0-SNAPSHOT + + UTF-8 + 11 + 11 + + + + org.openjfx + javafx-controls + 13 + + + org.openjfx + javafx-fxml + 13 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + com.example.App + + + + + + + diff --git a/Code/ost/_10_steuerrechner/src/main/java/com/example/App.java b/Code/ost/_10_steuerrechner/src/main/java/com/example/App.java new file mode 100644 index 0000000..339c80c --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/java/com/example/App.java @@ -0,0 +1,38 @@ +package com.example; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +/** + * JavaFX App + */ +public class App extends Application { + + private static Scene scene; + + @Override + public void start(Stage stage) throws IOException { + scene = new Scene(loadFXML("primary"), 640, 480); + stage.setScene(scene); + stage.show(); + } + + static void setRoot(String fxml) throws IOException { + scene.setRoot(loadFXML(fxml)); + } + + private static Parent loadFXML(String fxml) throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml")); + return fxmlLoader.load(); + } + + public static void main(String[] args) { + launch(); + } + +} \ No newline at end of file diff --git a/Code/ost/_10_steuerrechner/src/main/java/com/example/PrimaryController.java b/Code/ost/_10_steuerrechner/src/main/java/com/example/PrimaryController.java new file mode 100644 index 0000000..a23d23c --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/java/com/example/PrimaryController.java @@ -0,0 +1,12 @@ +package com.example; + +import java.io.IOException; +import javafx.fxml.FXML; + +public class PrimaryController { + + @FXML + private void switchToSecondary() throws IOException { + App.setRoot("secondary"); + } +} diff --git a/Code/ost/_10_steuerrechner/src/main/java/com/example/SecondaryController.java b/Code/ost/_10_steuerrechner/src/main/java/com/example/SecondaryController.java new file mode 100644 index 0000000..4cbf23d --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/java/com/example/SecondaryController.java @@ -0,0 +1,12 @@ +package com.example; + +import java.io.IOException; +import javafx.fxml.FXML; + +public class SecondaryController { + + @FXML + private void switchToPrimary() throws IOException { + App.setRoot("primary"); + } +} \ No newline at end of file diff --git a/Code/ost/_10_steuerrechner/src/main/java/module-info.java b/Code/ost/_10_steuerrechner/src/main/java/module-info.java new file mode 100644 index 0000000..aab90f4 --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module com.example { + requires javafx.controls; + requires javafx.fxml; + + opens com.example to javafx.fxml; + exports com.example; +} diff --git a/Code/ost/_10_steuerrechner/src/main/resources/com/example/primary.fxml b/Code/ost/_10_steuerrechner/src/main/resources/com/example/primary.fxml new file mode 100644 index 0000000..fb7fa3d --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/resources/com/example/primary.fxml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/ost/_10_steuerrechner/src/main/resources/com/example/secondary.fxml b/Code/ost/_10_steuerrechner/src/main/resources/com/example/secondary.fxml new file mode 100644 index 0000000..402e529 --- /dev/null +++ b/Code/ost/_10_steuerrechner/src/main/resources/com/example/secondary.fxml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/Code/ost/_10_steuerrechner/target/classes/com/example/secondary.fxml b/Code/ost/_10_steuerrechner/target/classes/com/example/secondary.fxml new file mode 100644 index 0000000..402e529 --- /dev/null +++ b/Code/ost/_10_steuerrechner/target/classes/com/example/secondary.fxml @@ -0,0 +1,16 @@ + + + + + + + + + +