(**** * * This file defines objects and operations related to the Roster. * *) module Roster; from DeskDrawer import Snapshot, Overlay; export Roster; obj ProgramLocation; obj QuestionQueueLength is integer; obj Present; obj Remote; object Roster is components: ClassList*, CurrentUser, Permission, QuestionQueueLength; description: (* The Roster has a collection of ClassList and contains the information of the current user. The system access permission is also chosen in the Roster. QuestionQueueLength is the number of people in the Question Queue. *); end Roster; object CurrentUser is Student; object ClassList is components: Student*, StartClassTime, EndClassTime, StartDate, EndDate, ClassName; description: (* A ClassList contains a list of students. ClassName is the class section name. StartClassTime is the official time the class starts. EndClassTime is the official time the class ends. Start Date is the first day of the class. EndDate is the last day of the class. *); end ClassList; object StartClassTime is Time; object EndClassTime is Time; object Time is Hour and Minute and am; object Hour is integer; object Minute is integer; object am is boolean; (* am is TRUE when the hour is between midnight and noon. am is FALSE when the hour is pm *) object StartDate is Date; object EndDate is Date; object Date is Month and Day; object Month is integer; object Day is integer; object ClassName is string; object Student is components: StudentName, QueueNumber, OverlayAccess, LoginStatus, ContactCard, GroupCheckbox; description: (* A Student contains the information and status of a student. StudentName is the name of the student. QueueNumber is the question queue position the student is currently located. OverlayAccess is the permission status of access the public Overlay. LoginStatus is the login status of the student. GroupCheckbox shows the group checkbox status. *); end Student; object ContactCard is components: Email, Machine, Major, Group*, StudentName, LoginStatus, Photo; description: (* The ContactCard displays the information of the student when the cursor is pointed to the student's name. Email is the email address of the student. Machine is the machineID of the student computer that student is currently logged on. Major is the major concentration of the student Group is the student group the student is assigned in. Photo is the photo of the student. *); end ContactCard; object StudentName is string; object Email is string; object Machine is string; object Major is string; object QueueNumber is integer; object Photo is jpg; obj jpg is string; object Group is components: GroupName, Member*; description: (* A Group contains a GroupName and a collection of Member. *); end Group; object GroupName is string; object Member is Student; object GroupCheckbox is boolean; object OverlayAccess is boolean description: (* OverlayAccess is either the access to the public overlay is granted or denied. *); end OverlayAccess; object LoginStatus is components: Present, Remote; description: (* LoginStatus contains Present and Remote. Present means the student is present in class. If the value of Present is FALSE, the student is absent from class. Remote means the student is present but not physically in class. *); end LoginStatus; object Permission is components: ProgramLocation*; description: (* Permission is the access level of students to the system program set by the instructor. ProgramLocation is the location of the program being banned by the instructor. *); end Permission; object Free inherits from Permission description: (* Free is one of the mode in Permission. In this mode, students are free to access all the applications in the system. The value of ProgramLocation in this mode is set to NULL. *); end Free; object Restricted inherits from Permission description: (* Restricted is one of the mode in Permission. In this mode, students can only access applications that are approved by the instructor, which means applications that are not banned by the instructor. The value of ProgramLocation in this mode is set by the instructor. *); end Restricted; object Lock inherits from Permission description: (* Lock is one of the mode in Permission. In this mode, students cannot access any applications in the system. *); end Lock; operation CreateClass is inputs: ClassName, StartClassTime, EndClassTime, StartDate, EndDate; outputs: ClassList; precondition: (* ClassName is non-empty. *); postcondition: (* A ClassList object is created. *); description: (* To create a new class list*); end CreateClass; operation LoadClass is inputs: ClassList; outputs: Roster; precondition: (* The ClassList exists in Roster. *); postcondition: (* The class list appears in the Roster *); description: (* To load a class list to the Roster *); end LoadClass; operation DeleteClass is inputs: ClassList; outputs: Roster; precondition: (* The ClassList exists in Roster. *); postcondition: (* The class list is removed from the Roster. *); description: (* To delete a class list from the Roster *); end DeleteClass; operation AddStudent is inputs: StudentName, Email, Major, Photo, ClassList; outputs: Student, ClassList; precondition: (* The student to be added to the ClassList must not exist in that ClassList. The StudentName must be non-empty. *); postcondition: (* The ClassList is non-empty and the newly added Student is in the ClassList. *); description: (* To enroll new student to the class by adding that student to the ClassList. *); end AddStudent; operation DeleteStudent is inputs: StudentName, ClassList; outputs: ClassList; precondition: (* The student to be deleted to the ClassList must exist in that ClassList. The StudentName must be non-empty. *); postcondition: (* The ClassList does not contain that Student in the list. *); description: (* To drop a student from class by removing that student from the ClassList. *); end AddStudent; operation EditStudent is inputs: ClassList, Student; outputs: ClassList, Student; precondition: (* The Student exists in that ClassList. *); postcondition: (* *); description: (* To edit the information of a student *); end EditStudent; operation SetPermission is inputs: ClassList, perm:Permission; outputs: Roster; precondition: (* Can only choose one out of three permission modes, they are Free, Restricted or Lock. perm is (Free or Restricted or Lock) *); postcondition: (* The student Rosters operate under that permission mode. *); description: (* The instructor can set the access permissions to EClass for students*); end SetPermission; operation SetRestrictLevel is inputs: ProgramLocation*; outputs: Restricted; precondition: (* *); postcondition: (* Modified the value of Restricted permission mode *); description: (* The instructor can choose certain programs to be banned from students *); end SetRestrictLevel; operation ShortcutFormGroup is inputs: StudentName*, GroupName, GroupCheckbox*; outputs: Group, ContactCard*; precondition: (* GroupName is non-empty string and different from existing group names. *); postcondition: (* A Group is formed and the ContactCard of each Member of the Group is updated. *); description: (* It provides a shortcut way to form chat groups. *); end ShortcutFormGroup; operation EnterQuestionQueue is inputs: qql:QuestionQueueLength, ns:StudentName; outputs: qql':QuestionQueueLength, qn:QueueNumber; precondition: (* The student is not in the QuestionQueue already, i.e. QueueNumber is null. *); postcondition: qql + 1 = qql'; (* QueueNumber is not null. *) description: (* A student enters the Question Queue. *); end EnterQuestionQueue; operation MoveUpQuestionQueue is inputs: qn:QueueNumber*, qql:QuestionQueueLength; outputs: qn':QueueNumber*, qql':QuestionQueueLength; precondition: (* The QueueNumber is 0. QuestionQueueLength is not zero. *); postcondition: (qql - 1 = qql'); (* Each QueueNumber in the list is decremented by one. something like (forall i:integer qn[i] - 1 = qn'[i]); *) description: (* After the instructor answered the question from QueueNumber zero, the instructor moves the list of Question Queue up by one. *); end MoveUpQuestionQueue; operation RequestSnapshot is inputs: s:Snapshot; outputs: oa:OverlayAccess, s':Snapshot, o:Overlay; precondition: (* The student is not accessing the Snapshot at that time. *); postcondition: oa; (* The Overlay is linked to the student *) description: (* Request to access a Snapshot. *); end RequestSnapshot; end Roster;