/** * Removes a classroom from the teacher * * @param hour The hour of the classroom to remove * @return Whether or not the hour existed beforehand */ public boolean removeClassroom(int hour) { for (Classroom classroom : classrooms) { if (classroom.getHour() == hour) { return classrooms.remove(classroom); } } return false; }
/** * Gets a classroom the teacher has * * @param hour The hour of the classroom to get * @return The requested classroom * @throws java.lang.IllegalArgumentException If teacher doesn't have a class during hour */ public Classroom getClassroom(int hour) { for (Classroom classroom : classrooms) { if (classroom.getHour() == hour) { return classroom; } } throw new IllegalArgumentException(); }
/** * @param name * @param cap * @return New classroom assigned for this department/affinity */ public Classroom newClassroom(String name, int cap) { Classroom c = new Classroom(); c.building = name; c.room = name; c.capacity = cap; c.campus = this.affinity; c.restricted = true; c.type = "Classroom"; c.wheelchair = true; return c; }