module Admin export all; object Roster is components: atd*: Attendance*; operations: AddStudent, EditStudent, RemoveStudent,ViewScreen,GrantAccess, GrantAllAccess; description: (* Roster is a dialogue with the collection of students names that are enrolled in the class. It contains operations for the instructor to add/edit/remove students as well as loading a roster. It also has operation that grants students drawing access and view student screen. *); end InstructorRoster; object Attendance is components: sdb*: StudentDB*; description: (* Attendance is the component of Roster that stores information of students that are enrolled in the class. The name component is the student database, which contains a record of the student names, status, drawing status, and log on time. *); end Attendance; Object StudentDB is components: Name and Status and Draw and Time; description: (* A studentDB is the information stored about a registered student in e-Class roster. The Name component is the student's real name. The Status component is a string of text determine whether the student is drawing or requesting to draw. The Draw component is a boolean variable showing whether the student is drawing or not. The Time component is a string of text showing the studen't log on time. *); end StudentDB; Object Name is string; Object Status is string; Object Time is string; Object Draw is boolean; operation AddStudent inputs: sdb:StudentDB, atd: Attendance; outputs: sdb': StudentDB, atd': Attendance; precondition:(* The student's name cannot be NULL and the student's ID has to be numerical values The student's ID must be a unique 9 digit value. *) (sdb != nil) and (#(sdb.ID) == 9) and (not (exists (sdb' in sdb) sdb'.id = sdb.id); postcondtion:(* A new student has been added to the database and the student's name will appear on the roster attendance list *) forall (sdb': StudentDB) (sdb' in atd') iff ((sdb' = sdb) or (sdb' in atd)); description:(* Adds a new student to the current roster *); end; operation EditStudent inputs: atd:Attendance, std: StudentDB, old_sdb:StudentDB, new_sdb: StudentDB; outputs: atd': Attendance, stb': StudentDB; precondition:(* The old and new student database cannot be the same *) (old_sdb != new_sdb) and (* The old record is stored inside the Student database*) (old_sdb in sdb) and (*There is no student record in the input studentDB with the same id as * the new record to be added *) (not (exists (new_sdb' in atd) new_sdb'.id = new_sdb.id)) and (*The Id of the new student must not be emprt and have 9 integer values*) (new_sdb.id != nil) and (#(new_sdb.id) == 9); postcondtion:(* The student's information has been edited and saved in the database. The new name will appear on the roster attendance *) forall(sdb':StudentDB) (sdb' in atd') iff (((sdb' = new_sdb) or (sdb' in atd)) and (sdb' != old_sdb)) and (*If new ID is different than old id, then the old ID is replaced by the new * ID *) if (old_sdb.id != new_sdb.id) then (old_sdb.id = new_sdb.id); description:(* Change the Name and Id of the student *); end; Object Id is integer; operation RemoveStudent inputs: atd: Attendance, sdb: StudentDB; outputs: atd':Attendance, sdb': StudentDB; precondition:(* A name of the student on the roster list must be selected and the * name is in the StudentDB *) sdb in atd; postcondtion:(* Student has been removed from the attedance and the attedance list is updated *) (sdb' in atd'); description:(* Removes a student from the roster *); end; operation ViewScreen inputs: old_Lec: LectureScreen; outputs: new_Lec: Lecturescreen; precondition:(*A name of the student on the roster list must be selected to be viewed*); postcondtion:(* The instructor screen displays the screen of that selected student *) (new_Lec = oldLec); description:(* views the screen of a selected student *); end; object LectureScreen; operation GrantAccess inputs: sdb: StudentDB, atd: Attedance, lec: LectureScreen; outputs: sdb': StudentDB, atd': Attendance, lec': LectureScreen; precondition:(* a student name on the attendance list must be selected ); postcondtion:(* The student must not have drawing access at the moment. The student's drawing will now appear on all screens *) (sdb' in atd') iff (sdb.draw == false) and lec' = lec; description:(* grats the selected student access to draw *); end; operation GrantAllAcess inputs: stb: StudentDB, atd: Attendance, lec: LectureScreen; outputs: sdb': StudentDB, atd': Attendance, lec': LectureScreen; precondition:(* None at the moment *); postcondition:(* Every student in the list of Attedance contains drawing access*) forall (sdb in atd) sdb.draw = true and (* Attendance list is updated with all the students' 'Draw' checkbox checked*) atd' = atd and (*Students workstation screen can see other students drawing*) lec' = lec; description: (* The GrantAllAccess operation grants all students in the class roster access to draw lively and their drawings * are broadcasted to the entire network *); end; Object UserAccess is components: Mode*; description: (* UserAccess allows the instructor to set different accessing mode for the students. These modes determine how much access the students have over their workstations. *); end UserAccess; Object Mode is components: FreeAccess or LectureOnly or EnableProgram or Disable; description:(*The Mode object allows the intrucstor to select an access mode for the students. The four modes are FreeAccess, LectureOnly, EnableProgram, and Disable *); end Mode; Object FreeAccess is components: Access*; precondition:(* None yet *); postcondition:(* The useraccess mode is changed to free access*); description:(*This is a mode that grants the students all access to their workstation*); end FreeAccess; Object LectureOnly is components: Access*; precondition:(* None yet *); postcondition:(* The useraccess mode is changed to lecture only*); description:(*This is a mode that only allows e-Class lecture application to run in the students workstation*); end LectureOnly; Object EnableProgram is components: Access*; precondition:(* None yet*); postcondition:(* The useraccess mode is changed to Enable Program *); description:(*This is a mode that allows the instructor to allow selective applications for the students to use along with the lecture. *); end EnableProgram; Object Disable is components: Keyboard and Mouse; precondition:(* None yet *); postcondition:(* The useraccess mode is changed to Disable Mode and the user must select either Keyboards and/or Mouse to disable *); description:(*This is a mode that allows the instructor to disable either the Keyboards and/or mouse in the students workstations. *); end Disable; Object Access is component: AccessType; precondition: (* A type of mode must be selected *); postcondition:(* The access is changed to the access type contains in Mode *); description: (* The Access component contains that actual code that sets the actual mode *); End Access; Object AccessType is string; Object Keyboard is components: Access*; precondition( * The 'Disable' mode must be selected *); postcondition( * All keyboards in the students' workstations are now disabled*); description: (* The keyboard component disables all the students' keyboards access to their workstations *); End Keyboard; Object Mouse is components: Access*; precondition( *The 'Disable' mode must be selected *); postcondition( *All mouse in the students' workstations are now disabled*); description: (* The mouse component disables all the students' mouse access to their workstations *); End Mouse; operation SaveSettings inputs: f:File, ros: Roster,ua: UserAccess; ; outputs: f':File; precondition:(* the fileName to be saved must not be nil and cannot be existed*) f != nil and forall (f' in File) not(exists(f == f')); postcondtion:(* The roster information and the UserAccess settings are saved into a file *) f = (ros and ua) and f' = f; descriptiopn:(* The SaveSettings saves the current roster list in Roster and the current Mode and settings in UserAccess to a file with .adm extension *); end; operation LoadSettings inputs: f: File, ros: Roster, ua: UserAccess; outputs: f': File, ros': Roster, ua'= UserAccess; precondition:(* the file must exists *) f != nil and (* the file must have an extension of .adm *) (f' = f) iff (f.ext == ".adm"); postcondtion:(* The new roster is loaded, replacing the current roster*) ros' = ros and (* The new useraccess settings replaced the current useracess settings*) ua' = ua; descriptiopn:(* loads a roster and the UserAccess settings to this current settings*); end; Object File; end Admin;