java.lang.Object
page.codeberg.friedolyn.grades.Degree
Represents a university degree, e.g. Bachelor of
Science. The degree may be assigned a unique number that identifies it in the Friedolin system.


-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Integer
The number that identifies the degree uniquely.static HashMap
<Integer, KnownDegree> A collection of known degrees that are assigned a unique number.private @NonNull String
The human-readable name of the degree, e.g. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Degree object with the given title.Degree
(@NonNull KnownDegree knownDegree) Constructs a new Degree object with the given known degree. -
Method Summary
Modifier and TypeMethodDescriptionboolean
extractCode
(@NonNull String title) Parses thedegree code
from the giventitle
.getCode()
void
Updates thedegree number
that identifies the degree uniquely.void
Updates thetitle
of this degree.@NonNull String
toString()
-
Field Details
-
NUMBERED_DEGREES
A collection of known degrees that are assigned a unique number. The number is used to identify the degree in the Friedolin system. -
code
The number that identifies the degree uniquely. -
title
The human-readable name of the degree, e.g.Bachelor of Science
. If the degree is assigned anumber
, then it is removed from the title. The prefixAbschluss
is also removed.
-
-
Constructor Details
-
Degree
Constructs a new Degree object with the given title. If the title contains adegree number
, then it is extracted (removed) and stored in thecode
field. The prefixAbschluss
is also removed, if present.- Parameters:
title
- The human-readable name of the degree. Must not be blank.- Throws:
IllegalArgumentException
- If the title is blank.
-
Degree
Constructs a new Degree object with the given known degree. Thetitle
is set to the known degree'slabel
. If the known degree is assigned adegree number
, then it is stored in thecode
field.- Parameters:
knownDegree
- The known degree to set the title to.
-
-
Method Details
-
getCode
- Returns:
- The
degree number
that identifies the degree uniquely.
-
setTitle
Updates thetitle
of this degree. If the title contains adegree number
, then it is extracted (removed) and stored in thecode
field. The prefixAbschluss
is also removed, if present.- Parameters:
title
- The new human-readable name of the degree. Must not be blank.- Throws:
IllegalArgumentException
- If the title is blank.
-
setCode
Updates thedegree number
that identifies the degree uniquely.- Parameters:
code
- The new degree number.
-
equals
-
toString
-
extractCode
Parses thedegree code
from the giventitle
.- Parameters:
title
- The title containing the degree code.- Returns:
- The degree code, if the title contains one. Empty otherwise.
-