java.lang.Object
page.codeberg.friedolyn.grades.Account
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
The unique identifier of the account.private ECTS
The number of ECTS credits that the account's modules are worth in total.The modules that are part of this account but not of anysubaccounts
.private final @NonNull ArrayList
<Subaccount> The subaccounts that are part of this account and may contain their ownModules
.private String
The human-readable name of the account, e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aModule
to the end of this account'smodules list
.void
addModules
(@NonNull Module... modules) Adds the specifiedModule
s to the end of this account'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 modules from this account'smodules list
.void
Removes all subaccounts from this account'ssubaccounts list
.boolean
Checks if the values of this account's fields are equal to their counterparts in the given object (if it is anAccount
at all).getCode()
getECTS()
@NonNull ArrayList
<Subaccount> getTitle()
@NonNull Module
removeModule
(int index) Removes the module at the specified position in this account'smodules list
.boolean
removeModule
(@NonNull Module module) Removes the first occurrence of the specifiedModule
from this account'smodules list
, if it is present.removeModules
(int... indices) Removes the modules at the specified positions in this account'smodules list
.boolean
removeModules
(@NonNull Module... modules) Removes the specifiedModule
s from this account'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
Updates the account'scode
to the given value.void
Updates the account'sects
to the given value.void
Updates the account'stitle
to the given value.@NonNull String
toString()
-
Field Details
-
code
The unique identifier of the account. Usually just a capital letter, e.g.A
orB
. Does not contain the prefix labelKonto
. -
title
The human-readable name of the account, e.g.Module zur Vermittlung von mathematischen und naturwissenschaftlich-technischen Grundlagen
(meaning “Modules for the Conveyance of Mathematical and Scientific-Technical Basics”). -
ects
-
SUB_ACCOUNTS
The subaccounts that are part of this account and may contain their ownModules
. -
MODULES
The modules that are part of this account but not of anysubaccounts
.
-
-
Constructor Details
-
Account
public Account()
-
-
Method Details
-
getCode
-
getTitle
-
getECTS
-
getSubaccounts
- Returns:
- The subaccounts that are part of this account and may contain their own
Modules
.
-
getOrphanModules
- Returns:
- The modules that are part of this account but not of any
subaccounts
.
-
getModules
- Returns:
- All modules that are part of this account, including those of its
subaccounts
.
-
setCode
Updates the account'scode
to the given value.- Parameters:
code
- The new account code, which uniquely identifies the account among all accounts of the university. Must not be blank.- Throws:
IllegalArgumentException
- If the given code is blank.
-
setTitle
Updates the account'stitle
to the given value.- Parameters:
title
- The new account title, the human-readable name of the account. Must not be blank.- Throws:
IllegalArgumentException
- If the given title is blank.
-
setECTS
-
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 account'smodules list
.- Parameters:
module
- The module to add.
-
addModules
Adds the specifiedModule
s to the end of this account'smodules list
.- Parameters:
modules
- The modules to add.
-
removeModule
Removes the first occurrence of the specifiedModule
from this account'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 account'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 account'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 account'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 account'smodules list
. -
equals
Checks if the values of this account's fields are equal to their counterparts in the given object (if it is anAccount
at all). -
toString
-