5.3. Users (Users.sl)



(*
 * This is a specL for the different types of users in the Test Tool 
 *)

module Users;
import TestGroup.*;
import Question.*;
export *;

object Name = string;
object Password = string;
object userID = integer;

object User
   components: Name and Password and userID;
   description: (*
      An User is a generic definition for the types of people who 
      use this application. Name is the name of the user and 
      Password is the password the user uses to log into the application.
   *);
end User;

object Teacher extends User
   components: Gradebook* and Course*;
   operations: makeTest, deleteTest, editTest, assignProctor;
   description: (*
      A Teacher is a type of User that has a list of Gradebooks for grades about
      tests and a list of Courses for all courses they are giving tests for.
   *);
end Teacher;
object q = Question;
object q2 = Question;

operation makeTest
   inputs: test:Test;
   outputs: ft:Test;
   postcondition: (* Created test does not have multiples of the same question and
      has at least one question *) ;
   description: (* Creates a new test *);
end makeTest;

operation deleteTest
   inputs: Test, Test*;
   outputs: Test*;
   description: (* Deletes a test *);
end deleteTest;

operation teacherEditTest
   inputs: Test;
   outputs: Test;
   precondition: (* Test is not null *);
   description: (* Edits a test *);
end teacherEditTest;

operation assignProctor
   inputs: t:Test, p:Proctor;
   outputs: Test;
   precondition: (* Test and Proctor cannot be null *);
   postcondition: (* *);
   description: (* Assigns a proctor to a test *);
end assignProctor;

object Student extends User
   components: AnsweredTest* and Test* and Gradebook;
   operations: takeTest, viewGrades;
   description: (*
      A Student is a type of User that can take tests given by a Proctor.
      A Student contains a list of AnsweredTest they have completed and a list of
      Test which have not been completed. They also have a Gradebook that contains
      their grades/scrores for their completed tests.
   *);
end Student;

operation takeTest
   inputs: Test;
   outputs: AnsweredTest;
   precondition: (* Test is not null *);
   description: (* A student gets an empty test and fills it out with 
      their answers *);
end takeTest;

operation viewGrades
   inputs: Student;
   outputs: Gradebook;
   description: (* A student can view all the grades of tests they have taken *);
end viewGrades;

object Proctor extends User
   components: Course*;
   operations: giveTest, kickStudent, controlTest;
   description: (*
      A Proctor is a type of User who can administer a test. They have a list of Courses
      which contains tests that they can administer.
   *);

end Proctor;

operation giveTest
   inputs: Test;
   outputs: AnsweredTest*;
   precondition: (* Test is not null *);
   description: (* Administers a test *);
end giveTest;

operation kickStudent
   inputs: Student, Test;
   outputs: Student;
   precondition: (* Student and Test is not null *);
   description: (* Kicks a student from a test *);
end kickStudent;

operation controlTest
   inputs: Test*;
   outputs: Test*;
   precondition: (* There is at least one Test in Test *);
   description: (* Proctor takes control of tests they are administrating *);
end controlTest;

object Course
   components: Test* and Student*;
   description: (*
      A Course is a container that connects which Students can take which Tests.
   *);
end Course;

object Gradebook
   components: Course* and Student*;
   description: (*
      A Gradebook contains all the information for scores on taken tests of
      individual Students in Courses
   *);
end Gradebook;

end Users;

(* --------- START Taken from TestGroup.sl --------------- *)

(*
 * This is a specL for the AbstractTest class in our UML diagram 
 *)
module TestGroup;
import Question.*;
export *;

object qTimeLimit = integer;
object grade = integer;

object Test
	components: Question*;
	operations: editTest, practiceTest;
	description:
		(* A test that is contained by AbstractTest *);
end;

object AbstractTest
	components: Test*, qTimeLimit, grade;
	operations: (* NONE? *);
	description:
		(* An abstract lists of tests *);
end;

object AnsweredTest
	components: ;
	operations: autoGrade, submit;
	description:
		(* What an answered test contains after the students have inputed their data *);
end;

object GradedTest
	components: ;
	operations: getScore;
	description:
		(* after the test is graded by the teacher *);
end;


operation editTest
  inputs: AnsweredTest;
  outputs: Test;
  description: (* edit an answered test *);	
end editTest;

operation practiceTest
  inputs: AnsweredTest;
  outputs: Test;
  description: (* practice for an upcoming test *);
end practiceTest;

operation autoGrade
  inputs: GradedTest;
  outputs: Test;
  description: (* automatically grades functions of the test for a mock score 
								  still awaits for the teacher to finalize the grade*);
end autoGrade;

operation submit
  inputs: GradedTest;
  outputs: Test;
  description: (* used for the teacher to submit the finalized score *);
end submit;

operation getGradedTestScore
  inputs: GradedTest;
  outputs: grade;
  description: (* reports the grade of a graded test *);
end getGradedTestScore;

end TestGroup;

(* --------- END Taken from TestGroup.sl --------------- *)

(* --------- START Taken from Questions.sl ------------- *)

(****
 *
 * Module Question defines the objects and operations related to the Management of the Questions.
 *
 *)

module Question;
export *;

   object QuestionDatabase
      components: questions;
      description: (* The complete DB of questions availible to be used. *);
   end QuestionDatabase;

   object questions = Question*;

   object Question
      components: ID and question and images* and key and difficulty and timeLimit and course and lastTaken and parentID;
      description: (*"A Question is the information stored about a complete question. The ID a unique identifier by which the question is identifiied. Images is a list of Images shown in a question. Key is the solution to the question. Difficulty is the level of difficulty of the question, either E = Easy , M = Medium, H = Hard. timeLimit is ammount of time allocated to complete the question. course is the course this question is designed for. lastTaken is the date the question was last used. *);
   end Question;

   object Date = string;
   object Images = string;
   object ID = integer;
   object question = string;
   object images = Images*;
   object key = string;
   object difficulty = integer;
   object timeLimit = integer;
   object course = string;
   object lastTaken = Date;
   object parentID = ID;

   object AnsweredQuestion
      components: answer;
      description: (* An AnsweredQuestion contains the students answer to a Question *);
   end AnsweredQuestion;

   object answer = string;

   object GradedQuestion
      components: score;
      description: (* A GradedQuestion contains the score for a completed and graded question *);
   end GradedQuestion;

   object score = integer;

   object MultipleChoice
      components: options and answeredIndeces and numAllowedChoices;
      description: (* A MultipleChoice questions contains the specific information for this type of question. *);
   end MultipleChoice;

   object options = string*;
   object answeredIndeces = integer*;
   object numAllowedChoices = integer;

   object Coding
      components: script and answer;
      description: (* A Coding question contains the file script for grading and the solution to the question *);
   end Coding;

   object File = string;
   object script = File;
   object Answer = string;

   object LongAnswer
      components: keywords and orderMatters and wordCountLimit;
      description: (* A LongAnswer question contains the information for creation this type of question *);
   end LongAnswer;

   object keywords = string*;
   object orderMatters = boolean;
   object wordCountLimit = integer;

   object Fillin
      components: answers;
      description: (* A Fillin question contains a list of answers to the question *);
   end Fillin;

   object answers = string*;


   operation addQestion
      inputs: Question;
      outputs: QuestionDatabase;
      description: (* Adds a question to the database *);
   end addQuestion;

   operation editQuestion
      inputs: Question;
      outputs: QuestionDatabase;
      description: (* Edits an existing question in the database *);
   end editQuestion;

   operation deleteQuestion
      inputs: Question;
      outputs: QuestionDatabase;
      description: (* Deletes a question from the database *);
   end deleteQuestion;


   operation setScore
      inputs: score, AnsweredQuestion;
      outputs: GradedQuestion;
      description: (* Sets the specific score of an Answered Question *);
   end setScore;

   operation getScore
      inputs: GradedQuestion;
      outputs: score;
      description: (* Gets the score for a GradedQuetion *);
   end getScore;

end Question;





Prev: testgroup.sl | Next: | Up: spec | Top: index