(**** * * This file defines objects and operation related to the student application * * 2.4 of the requirements * *) module StudentApp; from StudentFile import all; from StudentEdit import all; from View import CatalogView; from Teacher import Teacher_info, Name, Department, Email, Phone, Office, WTUS; export Summer, Winter, Fall, Spring, Quarters, FeedbackEntry, EntryDepartment, EntryCourseNumber, EntryInput; object Catalog is components: CatalogView; description: (* This is the tab for viewing the campus catalog *); end Catalog; object MyPlan is components: Quarters* and CourseField and QuarterField; description: (* The My Plan tab consists of a variable amount of Quarter nodes with combo boxes for course department. course number, and quarter name and year *); end MyPlan; object Quarters is components: y:Year and s:Season and pc:PlannedCourse*; description: (* Each quarter may contain a variable amount of planned courses *); end Quarters; object PlannedCourse is components: nd:NodeDepartment and ncn:NodeCourseNumber; description: (* A course consists of department name and course number *); end PlannedCourse; object Season is components: Fall or Winter or Spring or Summer; description: (* Combo box containing quarter names *); end Season; object Fall is description: (* Represents the Fall quarter for course plans *); end Fall; object Winter is description: (* Represents the Winter quarter for course plans *); end Winter; object Spring is description: (* Represents the Spring quarter for course plans *); end Spring; object Summer is description: (* Represents the Summer quarter for course plans *); end Summer; object Year is components: string; description: (* Combo box containing years from course database *); end Year; object NodeDepartment is components: string; description: (* Department name for a planned course *); end NodeDepartment; object NodeCourseNumber is components: string; description: (* The course number of a planned course *); end NodeCourseNumber; object CourseField is components: dept:MyPlanDepartmentField and cn:MyPlanCourseNumberField; description: (* Input parameters for adding a new planned course *); end CourseField; object QuarterField is components: year:MyPlanYearField and season:MyPlanSeasonField; description: (* Input parameters for adding a new planned quarter *); end QuarterField; object MyPlanDepartmentField is components: string; description: (* User input for Department *); end MyPlanDepartmentField; object MyPlanCourseNumberField is components: string; description: (* User input for Course Number *); end MyPlanCourseNumberField; object MyPlanYearField is components: string; description: (* User input for Year *); end MyPlanYearNumberField; object MyPlanSeasonField is components: Season; description: (* User input for season *); end MyPlanSeasonField; operation AddCourse is inputs: Q:Quarters*, cf:CourseField; outputs: Q':Quarters*; precondition: (* Entry fields can't be empty *) (cf.dept != nil) and (cf.cn != nil) and (* No duplicate classes are allowed *) forall(qtr in Q) forall(crs in qtr.pc) (crs.nd != cf.dept) and (crs.ncn != cf.cn); postcondition: (* All input quarters are in output *) forall(qtr in Q) (qtr in Q') and (* Input course exists in the list of output quarters *) exists(qtr in Q') exists(planc in qtr.pc) ((planc.nd = cf.dept) and (planc.ncn = cf.cn)); description: (* Plans a course for the selected quarter. *); end AddCourse; operation RemoveCourse is inputs: Q:Quarters*, SelectedCourse:PlannedCourse; outputs: Q':Quarters*; precondition: (* Course to remove exists *) exists(qtr in Q) exists(planc in qtr.pc) (SelectedCourse = planc); postcondition: (* No quarters are removed while removing a course *) (#Q = #Q') and (* Specified course doesn't exist in output *) forall(qtr:Quarters) (qtr in Q') iff ( forall(planc:PlannedCourse) (planc != SelectedCourse) and (planc in qtr.pc) and (qtr in Q)); description: (* Removes selected course from plan *); end RemoveCourse; operation AddQuarter is inputs: Q:Quarters*, qf:QuarterField; outputs: Q':Quarters*; precondition: (* Input fields can't be empty *) (qf.year != nil) and (qf.season != nil) and (* No duplicate quarters allowed *) forall(qtr in Q) ( (qtr.y != qf.year) and (qtr.s != qf.season) ); postcondition: (* Only the specified quarter and all the old quarters are in output *) forall(qtr:Quarters) (qtr in Q') iff ( ((qtr.y = qf.year) and (qtr.s = qf.season)) or (qtr in Q) ); description: (* Adds a quarter into the course plan *); end AddQuarter; operation RemoveQuarter is inputs: Q:Quarters*, SelectQuarter:Quarters; outputs: Q':Quarters*; precondition: (* Course to remove exists *) exists(qtr in Q) (SelectQuarter = qtr); postcondition: (* Specified course doesn't exist in output *) forall(qtr:Quarters) (qtr in Q') iff ((qtr != SelectQuarter) and (qtr in Q)); description: (* Removes a quarter from course plan *); end RemoveQuarter; object Feedback is components: FeedbackEntry* and EntryField; description: (* Feedback tab consisting of a variable list of entries with editable displays of the department, course number, and input of the entry *); end Feedback; object FeedbackEntry is components: ed:EntryDepartment and ecn:EntryCourseNumber and ei:EntryInput; description: (* A entry consists of a department, course number, and feedback content *); end Entries; object EntryDepartment is components: string; description: (* Field for containing department name of entry *); end EntryDepartment; object EntryCourseNumber is components: string; description: (* Field for containing course number of entry *); end EntryCourseNumber; object EntryInput is components: string; description: (* Field for containing input of entry *); end EntryInput; object EntryField is components: df:FeedbackDepartmentField and cnf:FeedbackCourseNumberField and cf:FeedbackCommentField; description: (* Parameters for adding a new feedback entry *); end EntryField; object FeedbackDepartmentField is components: string; description: (* Department field entry *); end FeedbackDepartmentField; object FeedbackCourseNumberField is components: string; description: (* Course Number field entry *); end FeedbackCourseNumberField; object FeedbackCommentField is components: string; description: (* Comment field entry *); end FeedbackCommentField; operation AddEntry is inputs: fe:FeedbackEntry, ef:EntryField; outputs: fe':FeedbackEntry; precondition: (* Entry fields can't be empty *) (ef.df != nil) and (ef.cnf != nil) and (ef.cf != nil); postcondition: (* Output entry list contains all old entries and added entry forall(f_entry:FeedbackEntry) (f_entry in fe') iff (((f_entry.df = ef.df) and (f_entry.cnf = ef.cnf) and (f_entry.cf = ef.cf)) or (f_entry in ef)); description: (* Take information form user input text fields to add feedback entry *); end AddEntry; operation DeleteEntry is inputs: fe:FeedbackEntry*, SelectEntry:FeedbackEntry; outputs: fe':FeedbackEntry*; precondition: (* Course to remove exists *) exists(f_entry in fe) (f_entry = SelectEntry); postcondition: (* Specified entry doesn't exist in output *) forall(f_entry:FeedbackEntry) (f_entry in fe') iff ((f_entry != SelectEntry) and (f_entry in fe)); description: (* Remove selected feedback entry *); end DeleteEntry; operation SendFeedback is inputs: fe:FeedbackEntry*, se:Server; outputs: se':Server; precondition: (* No precondition *); postcondition: (* Feedback entries are added to server *) forall(f_entry:FeedbackEntry) (f_entry in se'.sfe) iff ((f_entry in fe) or (f_entry in se.sfe)); description: (* Submit all feedback entries to student database *); end SendFeedback; object Teacher is components: SearchField and SearchResult*; description: (* The teacher tab consists of a input textfield of the teacher's name or email and a table view of search results *); end Teacher; object SearchField is components: string; description: (* The search field is a string *); end SearchField; object SearchResult is components: string; description: (* Names of professors are displayed as search results *); end SearchResult; object ProfessorDirectory is components: pName and pDepartment and pOffice and pPhone and pEmail and pWTUs; description: (* This is the window that appears when the user selects a search result and presses the view button. This window contains the professor's directory information. *); end ProfessorDirectory; object pName is components: string; description: (* Name of professor is a string type *); end pName; object pOffice is components: string; description: (* Office of professor is a string type *); end pOffice; object pPhone is components: string; description: (* Phonenumber of professor is a string type *); end pPhone; object pEmail is components: string; description: (* Email of professor is a string type *); end pEmail; object pDepartment is components: string; description: (* Department of professor is a string type *); end pDepartment; object pWTUs is components: integer; description: (* WTU value of professor is an integer type *); end pWTUs; operation Search is inputs: sf:SearchField, ti:Teacher_info* ; outputs: sr':SearchResults*; precondition: (* Search field can't be empty *) (sf != nil); postcondition: (* Search results is updated based on search field *) forall(rslt:SearchResults) (rslt in sr') iff exists(info:Teacher_info) ((sf = info.n) or (sf = info.e)) and (rslt = info.n); description: (* Do a search based on the search field and update search results *); end Search; object SearchResults is components: string; description: (* A search result is represented by first and last name *); end SearchResults; operation View is inputs: sr:SearchResult*, ti:Teacher_info*, SelectResult:SearchResults; outputs: pd':ProfessorDirectory; precondition: (* Selected Result must not be empty *) (SelectResult != nil); postcondition: (* The teacher entry corresponding to the selected search result is exists(t_info:Teacher_info) (SelectedResult.Name = t_info.Name) and (pd.pName = t_info.Name) and (pd.pDepartment = t_info.Department) and (pd.pOffice = t_info.Office) and (pd.pPhone = t_info.Phone) and (pd.pEmail = t_info.Email) and (pd.pWTUs = t_info.WTUS) and (pd.pOffice_hours = t_info.Office_hours); ; description: (* View the selected search result *); end View; end StudentApp;