java.lang.Object
page.codeberg.friedolyn.grades.GradesTable
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe accounts that are part of this grades table but not of anycourses
.The courses that the student is enrolled in and whose grades are listed in this table.The modules that are part of this grade table but not of anycourses
.private PersonalInformation
Personal data of the student that are included in the grades table.private final @NonNull ArrayList
<Subaccount> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAccount
(@NonNull Account account) Inserts a newAccount
at the end of this course'saccounts list
.void
addAccounts
(@NonNull Account... accounts) Inserts the specifiedAccount
s at the end of this course'saccounts list
.void
Inserts the specifiedCourse
at the end of this grade table'scourses list
.void
addCourses
(@NonNull Course... courses) Inserts the specifiedCourse
s at the end of this grade table'scourses list
.void
Adds aModule
to the end of this grade table'smodules list
.void
addModules
(@NonNull Module... modules) Adds the specifiedModule
s to the end of this grade table'smodules list
.void
addSubaccount
(@NonNull Subaccount subaccount) Inserts the specifiedSubaccount
at the end of this account'ssubaccounts list
.void
addSubaccounts
(@NonNull Subaccount... subaccounts) Inserts the specifiedSubaccount
s at the end of this account'ssubaccounts list
, in the given order.void
Removes all accounts from this course'saccounts list
.void
Removes all courses from this grade table'scourses list
.void
Removes all modules from this grade table'smodules list
.void
Removes all subaccounts from this account'ssubaccounts list
.boolean
Checks whether thisGradesTable
's fields are equal to their counterparts in the specified object (if it is a GradesTable at all).@NonNull Optional
<PersonalInformation> @NonNull ArrayList
<Subaccount> @NonNull Account
removeAccount
(int index) Removes the account at the specified position in this course'saccounts list
.boolean
removeAccount
(@NonNull Account account) Removes the first occurrence of the specifiedAccount
from this course'saccounts list
, if it is present.removeAccounts
(int... indices) Removes the accounts at the specified positions in this course'saccounts list
.boolean
removeAccounts
(@NonNull Account... accounts) Removes the specifiedAccount
s from this course'saccounts list
, if they are present.@NonNull Course
removeCourse
(int index) Removes the course at the specified position in this grade table'scourses list
.boolean
removeCourse
(@NonNull Course course) Removes the first occurrence of the specifiedCourse
from this grade table'scourses list
, if it is present.removeCourses
(int... indices) Removes the courses at the specified positions in this grade table'scourses list
.boolean
removeCourses
(@NonNull Course... courses) Removes the specifiedCourse
s from this grade table'scourses list
, if they are present.@NonNull Module
removeModule
(int index) Removes the module at the specified position in this grade table'smodules list
.boolean
removeModule
(@NonNull Module module) Removes the first occurrence of the specifiedModule
from this grade table'smodules list
, if it is present.removeModules
(int... indices) Removes the modules at the specified positions in this grade table'smodules list
.boolean
removeModules
(@NonNull Module... modules) Removes the specifiedModule
s from this grade table'smodules list
, if they are present.@NonNull Subaccount
removeSubaccount
(int index) Removes the subaccount at the specified position in this account'ssubaccounts list
.boolean
removeSubaccount
(@NonNull Subaccount subaccount) Removes the first occurrence of the specifiedSubaccount
from this account'ssubaccounts list
, if it is present.@NonNull ArrayList
<Subaccount> removeSubaccounts
(int... indices) Removes the subaccounts at the specified positions in this account'ssubaccounts list
.boolean
removeSubaccounts
(@NonNull Subaccount... subaccounts) Removes the specifiedSubaccount
s from this account'ssubaccounts list
, if they are present.void
Writes thisGradesTable
to the specified file in JSON format.void
setPersonalInformation
(@NonNull PersonalInformation personalInformation) Updates thepersonal data
of the student that are included in the grades table.@NonNull String
toJSON()
Converts thisGradesTable
to a JSON string with all fields.@NonNull String
toString()
-
Field Details
-
personalInformation
Personal data of the student that are included in the grades table. -
COURSES
-
ACCOUNTS
-
SUBACCOUNTS
-
MODULES
-
-
Constructor Details
-
GradesTable
public GradesTable()
-
-
Method Details
-
getPersonalInformation
- Returns:
- The
personal data
of the student that are included in the grades table.
-
getCourses
-
getAccounts
-
getSubaccounts
-
getOrphanModules
- Returns:
- The modules that are part of this grade table but not of any
courses
,accounts
orsubaccounts
.
-
setPersonalInformation
Updates thepersonal data
of the student that are included in the grades table.- Parameters:
personalInformation
- The student's personal data.
-
addCourse
Inserts the specifiedCourse
at the end of this grade table'scourses list
. -
addCourses
Inserts the specifiedCourse
s at the end of this grade table'scourses list
. -
removeCourse
Removes the first occurrence of the specifiedCourse
from this grade table'scourses list
, if it is present.- Parameters:
course
- The course to remove.- Returns:
true
if this list contained the specified element,false
otherwise.
-
removeCourses
Removes the specifiedCourse
s from this grade table'scourses list
, if they are present.- Parameters:
courses
- The courses to remove.- Returns:
true
if this list was modified as a result of this operation.
-
removeCourse
Removes the course at the specified position in this grade table'scourses list
.- Parameters:
index
- The index of the course to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The course previously at the specified position.
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
removeCourses
@NonNull public @NonNull ArrayList<Course> removeCourses(int... indices) throws IndexOutOfBoundsException Removes the courses at the specified positions in this grade table'scourses list
.- Parameters:
indices
- The indices of the courses to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The courses previously at the specified positions.
- Throws:
IndexOutOfBoundsException
- If any of the indices are out of range.
-
clearCourses
public void clearCourses()Removes all courses from this grade table'scourses list
. -
addAccount
Inserts a newAccount
at the end of this course'saccounts list
.- Parameters:
account
- The account to add.
-
addAccounts
Inserts the specifiedAccount
s at the end of this course'saccounts list
.- Parameters:
accounts
- The accounts to add.
-
removeAccount
Removes the first occurrence of the specifiedAccount
from this course'saccounts list
, if it is present.- Parameters:
account
- The account to remove.- Returns:
true
if this list contained the specified element,false
otherwise.
-
removeAccounts
Removes the specifiedAccount
s from this course'saccounts list
, if they are present.- Parameters:
accounts
- The accounts to remove.- Returns:
true
if this list was modified as a result of this operation.
-
removeAccount
Removes the account at the specified position in this course'saccounts list
.- Parameters:
index
- The index of the account to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The account previously at the specified position.
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
removeAccounts
@NonNull public @NonNull ArrayList<Account> removeAccounts(int... indices) throws IndexOutOfBoundsException Removes the accounts at the specified positions in this course'saccounts list
.- Parameters:
indices
- The indices of the accounts to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The accounts previously at the specified positions.
- Throws:
IndexOutOfBoundsException
- If any of the indices are out of range.
-
clearAccounts
public void clearAccounts()Removes all accounts from this course'saccounts list
. -
addSubaccount
Inserts the specifiedSubaccount
at the end of this account'ssubaccounts list
. -
addSubaccounts
Inserts the specifiedSubaccount
s at the end of this account'ssubaccounts list
, in the given order. -
removeSubaccount
Removes the first occurrence of the specifiedSubaccount
from this account'ssubaccounts list
, if it is present.- Parameters:
subaccount
- The subaccount to remove.- Returns:
true
if this list contained the specified element,false
otherwise.
-
removeSubaccounts
Removes the specifiedSubaccount
s from this account'ssubaccounts list
, if they are present.- Parameters:
subaccounts
- The subaccounts to remove.- Returns:
true
if this list was modified as a result of this operation.
-
removeSubaccount
Removes the subaccount at the specified position in this account'ssubaccounts list
.- Parameters:
index
- The index of the subaccount to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The subaccount previously at the specified position.
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
removeSubaccounts
@NonNull public @NonNull ArrayList<Subaccount> removeSubaccounts(int... indices) throws IndexOutOfBoundsException Removes the subaccounts at the specified positions in this account'ssubaccounts list
.- Parameters:
indices
- The indices of the subaccounts to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The subaccounts previously at the specified positions.
- Throws:
IndexOutOfBoundsException
- If any of the indices are out of range.
-
clearSubaccounts
public void clearSubaccounts()Removes all subaccounts from this account'ssubaccounts list
. -
addModule
Adds aModule
to the end of this grade table'smodules list
.- Parameters:
module
- The module to add.
-
addModules
Adds the specifiedModule
s to the end of this grade table'smodules list
.- Parameters:
modules
- The modules to add.
-
removeModule
Removes the first occurrence of the specifiedModule
from this grade table'smodules list
, if it is present.- Parameters:
module
- The module to remove.- Returns:
true
if this list contained the specified element,false
otherwise.
-
removeModules
Removes the specifiedModule
s from this grade table'smodules list
, if they are present.- Parameters:
modules
- The modules to remove.- Returns:
true
if this list was modified as a result of this operation.
-
removeModule
Removes the module at the specified position in this grade table'smodules list
.- Parameters:
index
- The index of the module to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The module previously at the specified position.
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
removeModules
@NonNull public @NonNull ArrayList<Module> removeModules(int... indices) throws IndexOutOfBoundsException Removes the modules at the specified positions in this grade table'smodules list
.- Parameters:
indices
- The indices of the modules to remove. Must be between 0 (inclusive) and the size of the list (exclusive).- Returns:
- The modules previously at the specified positions.
- Throws:
IndexOutOfBoundsException
- If any of the indices are out of range.
-
clearModules
public void clearModules()Removes all modules from this grade table'smodules list
. -
equals
Checks whether thisGradesTable
's fields are equal to their counterparts in the specified object (if it is a GradesTable at all). -
toJSON
Converts thisGradesTable
to a JSON string with all fields.- Returns:
- The JSON representation of this object.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- If the object could not be converted to JSON. SeeObjectMapper.writeValueAsString(Object)
.
-
saveTo
Writes thisGradesTable
to the specified file in JSON format.- Parameters:
file
- The file to save this object to. Must exist, not be a directory and be writable.- Throws:
IllegalArgumentException
- If the file does not exist, is a directory or is not writable.IOException
- If the file could not be written to. SeeWriter.write(String)
.
-
toString
- Overrides:
toString
in classObject
- Returns:
- A string representation of this
GradesTable
with all fields as well as this object'shash code
.
-