| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  | import java.util.List;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  | public class BreakSchedule {
 | 
					
						
							| 
									
										
										
										
											2024-11-26 20:42:04 +01:00
										 |  |  |     // #region Break Times Constants
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |     public static final int[] START_SMALL_BREAK = {
 | 
					
						
							|  |  |  |             830, 1025, 1115, 1205, 1330, 1420, 1610, 1700, 1750
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |     };
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |     public static final int[] END_SMALL_BREAK = {
 | 
					
						
							|  |  |  |             835, 1030, 1120, 1210, 1335, 1425, 1615, 1705, 1755
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |     };
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |     public static final int[] START_LONG_BREAK = {
 | 
					
						
							|  |  |  |             920, 1510
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |     };
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |     public static final int[] END_LONG_BREAK = {
 | 
					
						
							|  |  |  |             940, 1525
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |     };
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-26 20:42:04 +01:00
										 |  |  |     // #region Create Breaks Method
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |     public static Break[] createBreaks(int[] startTimes, int[] endTimes, List<Co2Data> co2Data) {
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |         Break[] breaks = new Break[startTimes.length];
 | 
					
						
							|  |  |  |         for (int i = 0; i < startTimes.length; i++) {
 | 
					
						
							| 
									
										
										
										
											2024-11-26 11:47:06 +01:00
										 |  |  |             Co2Data[] co2Datas = new Co2Data[endTimes[i] - startTimes[i]];
 | 
					
						
							|  |  |  |             for (Co2Data data : co2Data) {
 | 
					
						
							|  |  |  |                 if (data.getTime() >= startTimes[i] && data.getTime() < endTimes[i]) {
 | 
					
						
							|  |  |  |                     co2Datas[data.getTime() - startTimes[i]] = data;
 | 
					
						
							|  |  |  |                 }
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |             breaks[i] = new Break(startTimes[i], endTimes[i], co2Datas);
 | 
					
						
							| 
									
										
										
										
											2024-11-26 09:16:45 +01:00
										 |  |  |         }
 | 
					
						
							|  |  |  |         return breaks;
 | 
					
						
							|  |  |  |     }
 | 
					
						
							| 
									
										
										
										
											2024-11-26 20:42:04 +01:00
										 |  |  | }
 |