From 1716f0fb174c1c0b70ba913bbfcec2d94b3042a1 Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Wed, 20 Nov 2024 13:19:16 +0100 Subject: [PATCH] hekp me god --- .../CO2-Daten-Projekt-V2/bin/App.class | Bin 9439 -> 9378 bytes .../CO2-Daten-Projekt-V2/bin/FillTable.class | Bin 5391 -> 6112 bytes .../Steiner/CO2-Daten-Projekt-V2/src/App.java | 22 ++-- .../CO2-Daten-Projekt-V2/src/FillTable.java | 124 +++++++++++------- 4 files changed, 86 insertions(+), 60 deletions(-) diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/App.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/App.class index d4d89f4c2446cbc08dcd594a9dc08d6e42c34515..49fc4eca76d3ed152f7c0002904eead271775fb3 100644 GIT binary patch delta 2181 zcmZ8iZERcB8Gatyu^sy+cI+f=Y$v&KzMLjanvP^m)0UP%+mwt_8VYUcz)hUk%&~)g z)6&vn3T+u5Wr710t@x<+CmUkZNTy&)VcI4(je$04nlv`XCb~~;h#~C{j46BXbyBKb z%lEwJocBD>`+4pkhQB%dy;Gioiy(Y=#}CDO((%k>&kea;Hs_{|cZWICa5O{LSLaY51drSf_vYv}Rm>2zw$TAIk_EX{asa%L)#G4gt>!{fms zo)$w>`O!ptESbm+CB@nVQ5zevjGr-5>7J2P-WVL-Kisj8Xi|%wdhS=BdWM}|jT$S| zc5i!wk5w-E3I7+Tw&Zg0BYBMh2Gtqw4ri^#68C*P_m5jV)|dJGEA4yT%wh)KP6)c_&x9*hK_YuNJJ<*o|ih z*K|%`)0qHlY*(LXhkFM!uE#mTlZ;yd9nKgYtmOuc8%<_cMuNPwcCCgdh38yFltb!L zMKfTfwCg=RSlQV{q%1r9x*~6Lc?(P8WyjiTngomBH zMdNPe^VRg-#=S1yz8oE^AV!n9M0{N1KJF*V^65lknsCH+bnNl)0Pl41t7@;WnRlt< zzQ@;2YD}_~a2wg(hWIw==G{cq>i>UC(zFDDQ)8OTp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mrhCr}V zG&qIz&_xXFDat6K2k9lEpoi}Fva4NxK#@-CY<+6Zuvy>!Zfmda8!PHx?7cU6b2ODg z1%6%eUQ=i5&GB`yaHvHZ^sFtbd(Cl0K zlDyYUi8n=KmVvhd?$&6e(ZHC1Q5DUVCGAOlVTsY+6tcE7w}k~Xr$KEcK`b0kv|0i# z$1=i^`ps+?7x2nn($Fz(=NhYo_iBw%>#<8R23AyK25RBMHq6I%6ksQoA%q}yp&Yxh z5e=wABO++R9>#T`1)Yf4dS+SjF?}i{gLp!uF}?^-iF9V=;~9~`XrK_%D2*Kv2XdjyN@+nIBc z)$_95O7RWcA3{}5w(54^AS!aQ-4YHVIE|)#^~QO4{IASmEcoAXfsQwHX#RI*mm&ge zH#(R~F1<_+3d(qvViwOBtvH!lNJlb(T;UkeM6`c!p0)~#X3^9Sa zDM7P-!{s8aPxx$K@?9)H!mOjTk8!@eoNpfj=;vIHb4oT!a02Ub5++WO@o7%_3=%j? z{^!WMmkfsN0e@cd3&zQ4Chw;h1sMHRGRntRIc=5oOgU|hRm<^>UY)graQ4HXuSo8P tM>1ayeF8om-? data, int[] time, int roomNumber) { // Calculate the time range for the break (e.g., a 5-minute break) int startMinute = time[0]; @@ -117,6 +117,7 @@ public class App { return Math.max(points, 0); // Ensure that points don't go below zero } + // #region 5+ min private static int calculateLongerBreakPoints(List data, int[] time, int roomNumber) { // Take the time for the entire break int startMinute = time[0]; @@ -151,11 +152,12 @@ public class App { return Math.max(points, 0); // Ensure that points don't go below zero } + // #region bonus private static int calculateBonusPoints(List data, int[] time, int roomNumber) { // Check if the next lesson isn't lunch or the same teacher (if the next lesson // is lunch, no bonus points possible) - boolean isTeacherChange = isTeacherChange(data, roomNumber); // Check if the teacher is changing - boolean isNextLessonLunch = isNextLessonLunch(data, roomNumber); + boolean isTeacherChange = isTeacherChange(data, roomNumber, time); // Check if the teacher is changing + boolean isNextLessonLunch = FillTable.isNextLessonLunch(); if (!isNextLessonLunch && isTeacherChange) { return 5; // Bonus points for teacher switch @@ -164,15 +166,11 @@ public class App { } } - private static boolean isTeacherChange(List data, int roomNumber) { - - return false; // Placeholder logic - } - - private static boolean isNextLessonLunch(List data, int roomNumber) { - // Logic to check if the next lesson is lunch (can be based on time and lesson - // schedule) - return false; // Placeholder logic + // #region checks + private static boolean isTeacherChange(List data, int roomNumber, int[] time) { + // go through the lesson table of that day and time for the room + // check if the last teacher in the room equals itself or another teacher + return false; // Placeholder logic (to be implemented based on the timetable) } private static Co2Data getCo2DataForMinute(List data, int minute) { diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java index 594f5b0..ddad80d 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java @@ -84,54 +84,7 @@ public class FillTable { "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) { - String whatBreak = ""; - for (int i = 0; i < END_TIMES.length; i++) { - String[] tempEnd = END_TIMES[i].split(":"); - String[] tempStart = START_TIMES[i].split(":"); - if (intHour >= Integer.parseInt(tempStart[0]) && intHour <= Integer.parseInt(tempEnd[0])) { - if (intMinute >= Integer.parseInt(tempStart[1]) - && intMinute <= Integer.parseInt(tempEnd[1])) { - if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) == 5) { - whatBreak = "short"; - } else if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) > 5) { - whatBreak = "long"; - } else { - whatBreak = "No Break"; - } - } - - } - } - return whatBreak; // If no break is found, return "No Break" - } - + // #region Check Methods static int[] whatTime(int intHour, int intMinute) { int[] result = new int[2]; // [most recent end time, next start time] result[0] = -1; // Initialize to -1 (no previous end time found) @@ -162,4 +115,79 @@ public class FillTable { return result; } + + static boolean isNextLessonLunch(int intHour, int intMinute, int roomIndex) { + int currentTimeInMinutes = intHour * 60 + intMinute; + int nextLessonIndex = getNextLessonIndex(currentTimeInMinutes, roomIndex); + + if (nextLessonIndex == -1) { + return false; + } + + String nextLessonStartTime = START_TIMES[nextLessonIndex]; + String[] nextLessonStartParts = nextLessonStartTime.split(":"); + int nextLessonStartInMinutes = Integer.parseInt(nextLessonStartParts[0]) * 60 + + Integer.parseInt(nextLessonStartParts[1]); + + if (nextLessonStartInMinutes > currentTimeInMinutes) { + String teacherShortName = App.timeTable[roomIndex][getDayIndex("Monday")][nextLessonIndex] + .getTeacherInitials(); + return teacherShortName.equals("Lunch"); + } + + return false; + } + + private static int getNextLessonIndex(int currentTimeInMinutes, int roomIndex) { + for (int i = 0; i < START_TIMES.length; i++) { + String[] startParts = START_TIMES[i].split(":"); + int startTimeInMinutes = Integer.parseInt(startParts[0]) * 60 + Integer.parseInt(startParts[1]); + + if (startTimeInMinutes > currentTimeInMinutes) { + return i; + } + } + + return -1; + } + + static boolean isBreak(int intHour, int intMinute) { + if (intHour >= 7 && intHour <= 17) { + for (int i = 0; i < START_TIMES.length; i++) { + 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]); + + if ((intHour > startHour || (intHour == startHour && intMinute >= startMinute)) && + (intHour < endHour || (intHour == endHour && intMinute < endMinute))) { + return false; + } + } + return true; + } + return false; + } + + static String whatBreakIsIt(int intHour, int intMinute) { + String whatBreak = ""; + for (int i = 0; i < END_TIMES.length; i++) { + String[] tempEnd = END_TIMES[i].split(":"); + String[] tempStart = START_TIMES[i].split(":"); + if (intHour >= Integer.parseInt(tempStart[0]) && intHour <= Integer.parseInt(tempEnd[0])) { + if (intMinute >= Integer.parseInt(tempStart[1]) + && intMinute <= Integer.parseInt(tempEnd[1])) { + if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) == 5) { + whatBreak = "short"; + } else if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) > 5) { + whatBreak = "long"; + } + } + } + } + return whatBreak; + } }