package schedule;
import schedule.Lecture;
public class Schedule{
	private static final int MAX_LECTURES = 50;
	Lecture[] lectures = new Lecture[MAX_LECTURES];
	private int nextLecture=0;

	public void addLecture(Lecture l){
		lectures[nextLecture]=l;
		nextLecture++;
	}

	public boolean scheduleIsOK(){
		for(Lecture l : lectures){
			for(Lecture l2 : lectures){
				if(l!=null&&l2!=null&&l.getName()!=l2.getName()){
					if(l.overlapsWith(l2)&&!l.isConsultation()&&!l2.isConsultation()){return false;}
				}
			}
		}
		return true;
	}

	public String listLectures(){
		String r="";
		for(Lecture l : lectures){
			if(l!=null){
				r+=l.show();
				r+="\n";
			}
		}
		return r;
	}
}