forked from getmubarak/JavaCleanCodeProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
97 lines (83 loc) · 2.92 KB
/
Course.java
File metadata and controls
97 lines (83 loc) · 2.92 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package dynamicTT;
import java.util.ArrayList;
import java.util.Iterator;
public class Course {
//represents each course
private int courseID;
private String courseName;
private ArrayList<Subject> subjectsIncluded= new ArrayList<Subject>();
private ArrayList<Combination> combinations=new ArrayList<Combination>();
public ArrayList<Combination> getCombinations() {
return combinations;
}
public void setCombinations(ArrayList<Combination> combinations) {
this.combinations = combinations;
}
private ArrayList<StudentGroups> studentGroups=new ArrayList<StudentGroups>();
public ArrayList<StudentGroups> getStudentGroups() {
return studentGroups;
}
public void setStudentGroups(ArrayList<StudentGroups> studentGroups) {
this.studentGroups = studentGroups;
}
Course(int id, String name, ArrayList<Subject> subjects){
System.out.println("creating new course.......");
this.courseID=id;
this.courseName=name;
this.subjectsIncluded=subjects;
}
public void createStudentGroups(){
int size=0;
ArrayList <Combination>combs=new ArrayList<Combination>();
Iterator<Subject> subjectIterator=subjectsIncluded.iterator();
while(subjectIterator.hasNext()){
Subject subject=subjectIterator.next();
Iterator combIterator =combinations.iterator();
while(combIterator.hasNext()){
Combination combination = (Combination) combIterator.next();
ArrayList<String> subjects = combination.getSubjects();
Iterator<String> subjectItr = subjects.iterator();
while(subjectItr.hasNext()){
if(subjectItr.next().equalsIgnoreCase(subject.getSubjectName())){
size=size+combination.getSizeOfClass();
if(!combs.contains(combination.getSubjects())){
combs.add(combination);
}
}
}
}
StudentGroups studentGroup=new StudentGroups(this.courseName+"/"+subject.getSubjectName(), subject.getNumberOfLecturesPerWeek(), size, combs, subject.getSubjectName(), subject.isIslab(), subject.getDepartment());
studentGroups.add(studentGroup);
size=0;
}
}
//creates all possible professor x subject he teaches combinations and saves as lecture objects
public void createCombination(String subjects, int size){
Combination combination=new Combination(subjects, size);
combinations.add(combination);
}
public int getCourseID() {
return courseID;
}
public void setCourseID(int courseID) {
this.courseID = courseID;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
// public ArrayList<Professor> getProfessorsTeaching() {
// return professorsTeaching;
// }
// public void setProfessorsTeaching(ArrayList<Professor> professorsTeaching) {
// this.professorsTeaching = professorsTeaching;
// }
public ArrayList<Subject> getSubjectsTaught() {
return subjectsIncluded;
}
public void setSubjectsTaught(ArrayList<Subject> subjectsTaught) {
this.subjectsIncluded = subjectsTaught;
}
}