コード例 #1
0
ファイル: Mathematics.java プロジェクト: jingyli/AYJDatabase
  // This overrides the abstract method in the Department class.
  // It determines the ACL based on the number of courses a teacher is able to teach and his/her
  // experience of teaching.
  // If more than one teacher has the maximum combination, then the ACL is the teacher whose name
  // will appear first in the list if it is sorted alphabetically.
  // It takes in no parameters and returns a Teacher object.
  public Teacher determineACL() {
    // This initializes the ACL to be the first teacher in the array.
    Teacher temACL = teacherList.get(0);

    // This loops through the teacher list to find the teacher with the longest experience.
    for (int i = 1; i < teacherList.size(); i++) {
      int experienceDif = temACL.compareToExperience(teacherList.get(i));
      int teachingDivDif = temACL.compareToTeachingDiversity(teacherList.get(i));

      if (experienceDif + teachingDivDif < 0) {
        temACL = teacherList.get(i);
      } else if (experienceDif + teachingDivDif == 0) {
        if (teacherList.get(i).compareToName(temACL) < 0) {
          temACL = teacherList.get(i);
        }
      }
    }
    return temACL;
  }