package view.table;

import java.util.Collection;

import resources.course.Course;
import resources.instructor.Instructor;
import resources.room.Room;
import create.Schedule;
import create.Section;
/**
 * This class represents all model information regarding
 * a table view of a Schedule within the Scheduler proejct.
 * A schedule consists of teachers mapped to class sections
 * and class sections mapped to classrooms on the Cal Poly
 * campus. The Table view represents a list view of the schedule
 * where the list view can be ordered (increasing or decreasing)
 * by the course name, the instructor name, time of the class,
 * or days the class is taught. 
 * 
 * This class is also used to filter courses depending on the specifications
 * determined in the filter courses section of the view menu.
 * 
 * @author Deniz Tumer
 * @version 2/25/15
 */
public abstract class ViewTable {
	public Schedule selectedSchedule;
	
	/**
	 * Sorts the table view of the schedule based on the name of the course sections.
	 *
	 	post:
	 		//
	 		//checks to see if the collection has been successfully sorted.
	 		//each element should be less than the element ahead of it.
	 		//
			forall(int i; (i >= 0) && (i < return.size() - 1);
	 			return.get(i).course.compareTo(return.get(i + 1).course) < 0);
	 */
	public abstract Collection<Section> sortByCourse();
	
	/**
	 * Sorts the table view of the scheduled sections 
	 * based on the name of the instructor.
		post:
	 		//
	 		//checks to see if the collection has been successfully sorted.
	 		//each element should be less than the element ahead of it.
	 		//
	 		forall (int i; (i >= 0) && (i < return.size() - 1);
	 			return.get(i).instructor.compareTo(return.get(i + 1).instructor) < 0);
	 */
	public abstract Collection<Section> sortByInstructor();
	
	/**
	 * Sorts the table view of the scheduled sections based on the time they are being
	 * taught during a given day.
	 	post:
	 		//
	 		//checks to see if the collection has been successfully sorted.
	 		//each element should be less than the element ahead of it.
	 		//
	 		forall (int i; (i >= 0) && (i < return.size() - 1);
	 			return.get(i).time.compareTo(return.get(i + 1).time) < 0);
	 */
	public abstract Collection<Section> sortByTime();
	
	/**
	 * Sorts the table view of the scheduled sections based on the days they are being
	 * taught. The days they are being taught are the day patterns associated with 
	 * the course section.
	 	post:
	 		//
	 		//checks to see if the collection has been successfully sorted.
	 		//each element should be less than the element ahead of it.
	 		//
	 		forall (int i; (i >= 0) && (i < return.size() - 1);
	 			return.get(i).pattern.compareTo(return.get(i + 1).pattern) < 0);
	 */
	public abstract Collection<Section> SortByDays();
	
	/**
	 * Filters out all sections that are NOT contained within the specified room.
	 * 
	 * @param room The specified room to examine. All sections that are taught in
	 * this room is contained within the return value
	 * 
	 * @return All sections taught within the specified room
	 */
	public abstract Collection<Section> filterByRoom(Room room);
	
	/**
	 * Filters out all sections that are NOT taught by the specified instructor.
	 * 
	 * @param instructor The specified instructor to examine. All sections taught by
	 * this instructor are contained within the return value
	 * 
	 * @return All sections taught by the specified instructor
	 */
	public abstract Collection<Section> filterByInstructor(Instructor instructor);
	
	/**
	 * Filters out all sections that are NOT or the specified course type.
	 * 
	 * @param course The specified course to examine. All sections that are of
	 * the specified course type are contained within the return value
	 * 
	 * @return All sections that are of the specified course type
	 */
	public abstract Collection<Section> filterByCourse(Course course);
}