java.lang.Object
page.codeberg.friedolyn.grades.Exam
- All Implemented Interfaces:
Copyable<Exam>
,Redactable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Whether the exam is over and, if so, whether successful or not. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LocalDate
The date on which the exam was added to the student's grades table in the Friedolin system.private Integer
Which time the student took the exam, starting with 1 for the first attempt.private LocalDate
The date on which the exam took place.private String
The name of the professor who conducted the exam, graded it or was responsible for the accounting.private String
The “Prüfungsnummer” (exam number) assigned to the exam, without the labelP-Nr.:
.private String
The human-readable name of the exam, e.g.private Grade
The student's grade in the exam, between 0.7 and 5.0.private Semester
The semester in which the exam took place.private Exam.ExamStatus
Whether the exam is over and, if so, whether successful or not. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeDifference
(@NonNull Exam other) @NonNull Exam
copy()
boolean
Compares thisExam
with the given object.getGrade()
@NonNull Optional
<Exam.ExamStatus> void
setAccountingDate
(@NonNull LocalDate accountingDate) Updates theaccountingDate
to the given value.void
setAttempt
(int attempt) Updates theattempt
to the given value.void
setExamDate
(@NonNull LocalDate examDate) Updates theexamDate
to the given value.void
setExaminer
(@NonNull String examiner) Updates theexaminer
to the given value.void
setExamNumber
(@NonNull String examNumber) Updates theexamNumber
to the given value.void
setExamTitle
(@NonNull String examTitle) Updates thehuman-readable name of the exam
to the given value.void
Updates thegrade
to the given value.void
setSemester
(@NonNull Semester semester) Updates thesemester
to the given value.void
setStatus
(@NonNull Exam.ExamStatus status) Updates thestatus
to the given value.@NonNull String
toString()
@NonNull String
-
Field Details
-
examNumber
The “Prüfungsnummer” (exam number) assigned to the exam, without the labelP-Nr.:
. -
examTitle
The human-readable name of the exam, e.g.Fortgeschrittenes Programmierpraktikum: Projekt
orSystemsoftware: Klausur oder mündliche Prüfung
. -
semester
-
grade
-
status
Whether the exam is over and, if so, whether successful or not. -
attempt
Which time the student took the exam, starting with 1 for the first attempt. -
examDate
The date on which the exam took place. May be missing for unknown reasons.Missing exam date:
-
examiner
The name of the professor who conducted the exam, graded it or was responsible for the accounting. Which role the examiner had is not specified by the Friedolin system. May be missing for unknown reasons.Missing examiner:
-
accountingDate
The date on which the exam was added to the student's grades table in the Friedolin system.
-
-
Constructor Details
-
Exam
public Exam()
-
-
Method Details
-
getExamNumber
- Returns:
- The
examNumber
, if present. Empty otherwise.
-
getExamTitle
-
getSemester
-
getGrade
-
getStatus
- Returns:
- The
status
, if present. Empty otherwise.
-
getAttempt
-
getExamDate
-
getExaminer
-
getAccountingDate
- Returns:
- The
accountingDate
, if present. Empty otherwise.
-
setExamNumber
Updates theexamNumber
to the given value. Strips the labelP-Nr.:
from the value, if present.- Parameters:
examNumber
- The new exam number. Expected (but not enforced) to be in the formatP-Nr.: 123456
. Must not be blank.- Throws:
IllegalArgumentException
- If the exam number is blank.
-
setExamTitle
Updates thehuman-readable name of the exam
to the given value.- Parameters:
examTitle
- The new exam's name. Must not be blank.- Throws:
IllegalArgumentException
- If the exam title is blank.
-
setSemester
-
setGrade
-
setStatus
Updates thestatus
to the given value.- Parameters:
status
- Whether the exam is over and, if so, whether successful or not. Must not be blank.
-
setAttempt
Updates theattempt
to the given value.- Parameters:
attempt
- Which time the student took the exam, starting with 1 for the first attempt. Must be greater than 0.- Throws:
IllegalArgumentException
- If the attempt number is less than 1.
-
setExamDate
Updates theexamDate
to the given value.- Parameters:
examDate
- The date on which the exam took place. Must be after 1990-10-03 and before today + 1 year.- Throws:
IllegalArgumentException
- If the exam date is before 1990-10-03 or after today + 1 year.
-
setExaminer
Updates theexaminer
to the given value.- Parameters:
examiner
- The name of the professor who conducted the exam, graded it or was responsible for the accounting. Must not be blank.- Throws:
IllegalArgumentException
- If the examiner's name is blank.
-
setAccountingDate
public void setAccountingDate(@NonNull @NonNull LocalDate accountingDate) throws IllegalArgumentException Updates theaccountingDate
to the given value.- Parameters:
accountingDate
- The date on which the exam was added to the student's grades table in the Friedolin system. Must be after 1990-10-03 and before today + 1 year.- Throws:
IllegalArgumentException
- If the accounting date is before 1990-10-03 or after today + 1 year.
-
equals
Compares thisExam
with the given object.- Overrides:
equals
in classObject
- Parameters:
object
- The object to compare this Exam with.- Returns:
-
true
if the given object is an Exam whose fields' values match their equivalents in this Exam, especially (but not exclusively) if the given Exam is the exact same reference as this Exam. -
false
if the given object is not an Exam or if any of the fields' values differ from their equivalents in this Exam.
-
-
computeDifference
- Parameters:
other
- A different Exam reference to compare this Exam with.- Returns:
-
Changes.oldVersion()
: A new Exam with the values of those fields of this Exam that differ from their equivalents in the given Exam. -
Changes.newVersion()
: A new Exam with the values of those fields of the given Exam that differ from their equivalents in this Exam. -
Changes.unchanged()
: A new Exam with the values of those fields that are the same in both Exams.
-
-
copy
-
toString
- Specified by:
toString
in interfaceRedactable
- Overrides:
toString
in classObject
- Returns:
- A string representation of this Exam.
-
toStringRedacted
- Specified by:
toStringRedacted
in interfaceRedactable
- Returns:
- A redacted string representation of this Exam.
-