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 IntegerThe number that identifies the degree uniquely.static HashMap<Integer, KnownDegree> A collection of known degrees that are assigned a unique number.private @NonNull StringThe 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 TypeMethodDescriptionbooleanextractCode(@NonNull String title) Parses thedegree codefrom the giventitle.getCode()voidUpdates thedegree numberthat identifies the degree uniquely.voidUpdates thetitleof this degree.@NonNull StringtoString()
-
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 prefixAbschlussis 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 thecodefield. The prefixAbschlussis 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. Thetitleis set to the known degree'slabel. If the known degree is assigned adegree number, then it is stored in thecodefield.- Parameters:
knownDegree- The known degree to set the title to.
-
-
Method Details
-
getCode
- Returns:
- The
degree numberthat identifies the degree uniquely.
-
setTitle
Updates thetitleof this degree. If the title contains adegree number, then it is extracted (removed) and stored in thecodefield. The prefixAbschlussis 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 numberthat identifies the degree uniquely.- Parameters:
code- The new degree number.
-
equals
-
toString
-
extractCode
Parses thedegree codefrom the giventitle.- Parameters:
title- The title containing the degree code.- Returns:
- The degree code, if the title contains one. Empty otherwise.
-