package testtool.teacher_app.grade_view; import java.util.List; import testtool.component.Lecture; import testtool.component.Test; /** * The GradeTest class is derived from the Test Grader View in Section * 2.6 of the requirements. It provides operations for the teacher * to grade tests. This class contains a Lecture field that has course * and section information for the test. The second data field is a list * of each student's test to be graded. The last field is the currently * selected test that is being graded by the user. */ public abstract class GradeTest { private Lecture lecture; private List tests; private Test currentTest; /** * gradeTests automatically grades all questions with exact answers * for every test in this.tests. It also will setup all short answer * to highlight any keywords in the student's answer. */ /*@ requires //this.tests to not be empty (this.tests != null && !this.tests.isEmpty()); ensures (* None yet. *); @*/ public abstract void gradeTests(); /** * sendToGradingProgram sends this.tests to the grader program. */ /*@ requires //this.tests to not be empty (this.tests != null && !this.tests.isEmpty()); ensures (* None yet. *); @*/ public abstract void sendToGradingProgram(); /** * sortTests sorts this.tests by the order specified by * the parameter sortFlag. */ /*@ requires //this.tests to not be empty (this.tests != null && !this.tests.isEmpty()); ensures (\forall int i ; (i >= 0) && (i < tests.size() - 1) ; tests.get(i).name.compareTo(tests.get(i+1).name) < 0); @*/ public abstract void sortTests(TestSort sortFlag); /** * sortQuestions sorts this.currentTest.questions by the order * specified by the parameter sortFlag. */ /*@ requires //this.tests to not be empty (this.tests != null && !this.tests.isEmpty()); ensures (\forall int i ; (i >= 0) && (i < tests.size() - 1) ; (\forall int j ; (j >= 0) && (j < tests.get(i).questions.size() - 1) ; tests.get(i).questions.get(j).questionText.compareTo(tests.get(i+1).questions.get(j).questionText) < 0)); @*/ public abstract void sortQuestions(QuestionSort sortFlag); /** * setScore modifies this.currentTest.questions.get(question).score * with correct and possible parameters. If possible is 0, or not * provided, then only correct modifies the question score. */ /*@ requires //this.tests to not be empty (this.tests != null && !this.tests.isEmpty()); ensures ((currentTest.questions.get(question).score.points == correct) && (currentTest.questions.get(question).score.possiblePoints == possible)); @*/ public abstract void setScore(int question, int correct, int possible); /** * TestSort resembles all the ways you can sort the list of tests. */ private enum TestSort { NAME, TIME, SCORE } /** * QuestionSort resembles all the ways you can sort the questions * of each test. */ private enum QuestionSort { NUMBER, CORRECT, QUESTION, SCORE } }