(* * * Module View defines the objects and operations related to the different * schedule views available to the user. Lists of scheduled items can be * viewed in one of two ways. The List view is simply a long list of all the * currently scheduled classes, and the calender view displays them in a * grid format to allow easier viewing of the schedule at a glance for the week. * *) module View; from Time import all; from Database import all; from ScheduleM import all; export all; object ListView is components: Class*; description: (* The ListView encompasses the entire schedule and all of its currently scheduled classes, displaying them in a large, scrollable list that contains the important information for each individual class. *); end ListView; object Class is components: Title and CourseNum and Units and Type; description: (* The Class contains all of the elements that are common to all classes, these certain qualities are always tru for a class that has been previously established by the University. *); end Class; object Title is description: (* The title of the course in the Course database (e.g. Fundamentals of Computer Science) *); end Title; object CourseNum is description: (* The number of the course in the Course database (e.g. 101, 102, etc) *); end CourseNum ; object Units is description: (* The number units the course is worth *); end Units; object Type is components: Lec or Lab or Act; description: (* The type of the class *); end Type; object Lec is description: (* A Lecture style course*); end Lec; object Lab is description: (* A Lab style course*); end Lab; object Act is description: (* A Activity style course*); end Act; object ScheduledClassView is components: Instructor and SectionNumber and Location and Time and DayPattern; description: (* A Scheduled class is simply a class that has been given another set of components that define it as a scheduled class that has been commited to. The scheduled class will contain the extra information like the Teacher that has been chosen to teach it as well as its location and times taught. *); end ScheduledClassView; object Location is components: Building and Room; description: (* The location for a certain class contains both the building number and room number.*); end Location; object Time is components: Hour; description: (* The hour that a class is being held, this number operates on a 24 hour "military" time style, so an AM or PM identifier is not needed..*); end Time; object CalenderView is components: TimeSlot*; description: (* A Calender view is simply a collection of TimeSlots displayed as a grid. These TimeSlots will contain any number of scheduled classes that match the specified Days and Time parameters. *); end CalenderView; object TimeSlot is components: Day and StartTime and EndTime and Class*; description: (* The TimeSlot conatins the information about what Day of the week and what hour it begins and ends, and a collection of the classes that are scheduled to match that particular time slot. *); end TimeSlot; object StartTime is components: Time; description: (* The starting time for a class*); end StartTime; object EndTime is components: Time; description: (* The ending time for a class, this is required because there are several type of classes that end at strange times.*); end EndTime; object SearchDialog is components: NameEnable and CourseEnable and NameKey and CourseKey and ViewType; description: (* The Search Dialog contains spaces for the desired search string for the Teacher name, Course number, and enabling checkboxes for each. It also has a "ListView" or "CalenderView" option toggle. *); end SearchDialog; object NameEnable is components: boolean; description: (* The check box in the search dialog that allows the entry of a Name for searching *); end NameEnable; object CourseEnable is components: boolean; description: (* The check box in the search dialog that allows the entry of a Course for searching *); end CourseEnable; object NameKey is components: string; description: (* The string that is taken in as a search parameter. *); end NameKey; object CourseKey is components: string; description: (* The string that is taken in as a search parameter. *); end CourseKey; object ViewType is components: ListView or CalenderView; description: (* The radio buttons that choose how the search results are viewed*); end ViewType ; object SearchResults is components: Class*; description: (* The search results for any given Search operation are simply a collection of all the classes that matched the search criteria outlined in operation "Search". *); end SearchResults; operation InstructorSearch is inputs: name:NameKey, type:ViewType, Insdatabase: InstructorDatabase; outputs: type':ViewType; precondition: ; postcondition: (* forall Instructors in Database whose name = NameKey, they are in the new View*); description: (* The InstructorSearch function takes in a name and type of view and the InstructorDatabase as inputs, and outputs the results of the search in the format of the input "type". *); end InstructorSearch; operation CourseSearch is inputs: course:CourseKey, type:ViewType, Coudatabase: CourseDatabase; outputs: type':ViewType; precondition: ; postcondition: (* forall courses in Database whose number = CourseKey, they are in the new View*); description: (* The CourseSearch function takes in a course number and type of view and the InstructorDatabase as inputs, and outputs the results of the search in the format of the input "type". *); end InstructorSearch; operation ViewbyTeacher is inputs: schedule: Schedule; outputs: Tview:TeacherView; precondition: (* there are teachers in the InstructorDatabase*); postcondition: (* forall Instructors in Database whose name = NameKey, they are in the new View*); description: (* This operation takes in the current schedule and outputs a new view that shows only the classes taught by the teacher that is being viewed. *); end ViewbyTeacher; operation ViewbyCourse is inputs: schedule: Schedule; outputs: Cview:CourseView; precondition: (* there are courses in theCourseDatabase*); postcondition: (* forall Courses in Database whose number = CourseKey, they are in the new View*); description: (* This operation takes in the current schedule and outputs a new view that shows only the classes that match the chosen course number. *); end ViewbyCourse; operation ViewbyPattern is inputs: schedule: Schedule; outputs: Pview:PatternView; precondition: (* there are courses in theCourseDatabase*); postcondition: (* forall Courses in Database whose pattern = PatternKey, they are in the new View*); description: (* This operation takes in the current schedule and outputs a new view that shows only the classes that match the chosen pattern type(e.g. MWF, TR, etc.). *); end ViewbyPattern ; object TeacherView is components: Class*; description: (* This view is a collection of all the classes that match the teacher that is being viewed. this should include all matches of scheduled classes with the Instructor name specified.*); end TeacherView; object CourseView is components: Class*; description: (* This view is a collection of all the classes that match the course number that is being viewed. this should include all matches of scheduled classes with the CourseNumber specified.*); end CourseView; object PatternView is components: Class*; description: (* This view is a collection of all the classes that match the pattern that is being viewed. this should include all matches of scheduled classes with the pattern specified.*); end PatternView; end View;