forked from mohachmadim/CS102Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkoutClass.java
57 lines (44 loc) · 1.9 KB
/
WorkoutClass.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.time.*;
import java.util.*;
public class WorkoutClass{
public WeeklyCalender workoutSchedule = new WeeklyCalender();//instead of creating a new weeklySchedule variable here all classes use the Weekly Calender class to reduce code redundancy --> delete this comment
//public boolean[][] weeklySchedule = new boolean[7][72]; --> delete this comment
public List<Member> courseMembers = new ArrayList<Member>();
public String className;
public String description;
public LocalDate startDate;
public LocalDate endDate;
public Coach coach;
public List<int[]> filledSlotsIndex = new ArrayList<int[]>(); // {[1,0], [1,1], ...} has the addresses that contain true
public WorkoutClass(List<int[]> index, String className, String description, LocalDate startDate, LocalDate endDate,
Coach coach) {
updateClassSchedule(index);
copyList(index, this.filledSlotsIndex);
this.className = className;
this.description = description;
this.startDate = startDate;
this.endDate = endDate;
this.coach = coach;
}
// function to copy the index from the constructor to filled slot index
public void copyList(List<int[]> copyThis, List<int[]> emptyList) {
for(int[] element: copyThis) {
emptyList.add(element);
}
}
//you can remake the schedule with an index of the slots you want
public void updateClassSchedule(List<int[]> index){
this.workoutSchedule.resetCalender();
for (int[] address : index) {
this.workoutSchedule.WeeklySchedule[address[0]][address[1]] = true;
}
}
//
/*public void resetCalender() {
for (int columns = 0; columns < 7 ; columns++) { this function is now redundant since we are using a weeklycalender object to store the workout schedule
for (int rows = 0; rows < 72; rows++) {
this.weeklySchedule[columns][rows] = false;
}
}
}*/
}