public abstract class Scores
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Collection<RawScore> |
rawScores
Collection of raw scores, each associated with a student and assignments.
|
Constructor and Description |
---|
Scores() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract void |
addRawScore(Student student,
Assignment assignment,
double score)
Enters a raw score for an assignment for a particular student.
|
(package private) abstract double |
getAverageScore(Assignment assignment)
Gets the average of all of the raw scores for a given assignment.
|
abstract double |
getRawScore(Student student,
Assignment assignment)
Retrieves the raw score for an assignment given to a particular student.
|
(package private) abstract void |
removeRawScore(Student student,
Assignment assignment)
Removes a raw score for an assignment for a particular student.
|
(package private) abstract void |
updateRawScore(Student student,
Assignment assignment,
double newScore)
Updates a raw score for an assignment for a particular student.
|
java.util.Collection<RawScore> rawScores
public abstract double getRawScore(Student student, Assignment assignment)
student
- studentassignment
- assignmentpost: // // If a RawScore was found, the returned RawScore should be in the // rawScores collection. If not, return is null. // Either way, rawScores should not have been changed. // (return == null || rawScores.contains(return)) && forall (RawScore score; rawScores'.contains(score) iff rawScores.contains(score));
abstract void addRawScore(Student student, Assignment assignment, double score)
student
- studentassignment
- assignmentscore
- raw score
pre: // // There must not be a RawScore in the rawScores collection corresponding // to the given Student and Assignment. // !exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment)); post: // // The rawScores collection should be unchanged except for the addition // of the new RawScore. // exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment)) && forall (RawScore score; rawScores'.contains(score) iff ((score.getStudent().equals(Student) && score.getAssignment().equals(assignment)) || rawScores.contains(score)));
abstract void updateRawScore(Student student, Assignment assignment, double newScore)
student
- studentassignment
- assignmentnewScore
- new raw score
pre: // // There must be a RawScore in the rawScores collection corresponding // to the given Student and Assignment. // exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment)); post: // // The rawScores collection should be unchanged except for the RawScore // corresponding to the given Student and Assignment, which should // reflect the new score. // exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment) && score.getScore() == newScore) && forall (RawScore score; rawScores'.contains(score) iff ((score.getStudent().equals(Student) && score.getAssignment().equals(assignment) && score.getScore() == newScore) || rawScores.contains(score)));
abstract void removeRawScore(Student student, Assignment assignment)
student
- studentassignment
- assignment
pre: // // There must be a RawScore in the rawScores collection corresponding // to the given Student and Assignment. // exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment)); post: // // The rawScores collection should be unchanged except for the removal of // the RawScore corresponding to the given Student and Assignment. // !exists (RawScore score; rawScores.contains(score); score.getStudent().equals(student) && score.getAssignment().equals(assignment)) && forall (RawScore score; rawScores'.contains(score) iff (rawScores.contains(score) && !(score.getStudent().equals(student) && score.getAssignment().equals(assignment))));
abstract double getAverageScore(Assignment assignment)
assignment
- assignment to compute average forpre: // // There must be at least one RawScore in the rawScores collection // corresponding to the given Assignment. // exists (RawScore score; rawScores.contains(score); score.getAssignment().equals(assignment)); post: // // The rawScores collection should be unchanged. // forall (RawScore score; rawScores'.contains(score) iff rawScores.contains(score));