summaryrefslogtreecommitdiff
path: root/src/com.example.portfolio2/com/example/portfolio2/Database.java
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-04-29 16:31:32 +0200
committerJonas Smedegaard <dr@jones.dk>2025-04-29 16:31:45 +0200
commit5c5a039691d2a18d198e0ea5b13ed53103cc66ff (patch)
tree9f886c048a41c97996744f4c4094b6e04b7d81c5 /src/com.example.portfolio2/com/example/portfolio2/Database.java
parentd34ce20410e65e43e466e55172d161aad777cd76 (diff)
move hardcoded subject module list to class Database
Diffstat (limited to 'src/com.example.portfolio2/com/example/portfolio2/Database.java')
-rw-r--r--src/com.example.portfolio2/com/example/portfolio2/Database.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/Database.java b/src/com.example.portfolio2/com/example/portfolio2/Database.java
index 85b2b09..d978e83 100644
--- a/src/com.example.portfolio2/com/example/portfolio2/Database.java
+++ b/src/com.example.portfolio2/com/example/portfolio2/Database.java
@@ -7,6 +7,7 @@
package com.example.portfolio2;
import java.util.ArrayList;
+import java.util.List;
/// Bachelorizer - database model
///
@@ -16,6 +17,14 @@ class Database {
/// database singleton
MyDB db = new MyDB();
+ /// available subject modules
+ // TODO: replace this dummy placeholder with database query
+ private List<String> Modules = List.of(
+ "Computer Science",
+ "Informatik",
+ "Astrology"
+ );
+
/// default constructor
// (declared explicitly only to silence javadoc)
Database() { }
@@ -25,6 +34,19 @@ class Database {
clearParticipation();
}
+ /// resolve subject module index from name
+ ///
+ /// @param name subject module name
+ /// @return index of subject module as integer
+ // TODO: replace this dummy placeholder with database query
+ int getModuleIndeks(final String name) {
+ if (name == null) {
+ return -1;
+ }
+
+ return Modules.indexOf(name);
+ }
+
/// resolve activity index from name
///
/// @param name activity name
@@ -102,6 +124,13 @@ class Database {
return result.getFirst();
}
+ /// list of available subject modules
+ ///
+ /// @return names of all subject moduless as list of strings
+ List<String> getAllModules() {
+ return Modules;
+ }
+
/// list of available activities
///
/// @return names of all activities as list of strings