}
private Course initCourse(SemesterTimetable sT, Course course,
Iterator<net.htmlparser.jericho.Element> colIt) {
int colNo = 0;
ClassTimetable clst = null;
while (colIt.hasNext()) {
net.htmlparser.jericho.Element cell = colIt.next();
String txt = cell.getTextExtractor().toString();
boolean emptyString = txt == null || txt.trim().isEmpty();
if (colNo == 0) {
if (emptyString) {
sameCourse = true;
} else {
course = new Course(sT);
sT.getCourses().add(course);
ntuTimetable.getCourses().add(course);
Setter.set(course, header[colNo], txt.trim());
sameCourse = false;
}
clst = new ClassTimetable(course, sT);
} else {
if (!emptyString) {
String trimmed = txt.trim();
if (!sameCourse) {
Setter.set(course, header[colNo], trimmed);
}
Setter.set(clst, header[colNo], trimmed);
}
}
++colNo;
}
ntuTimetable.getClassTimetables().add(clst);
sT.getClassTimetables().add(clst);
clst.calculateStartDate();
course.getClassTimetables().add(clst);
return course;
}