aboutsummaryrefslogtreecommitdiff
path: root/src/com.example.portfolio2/com/example/portfolio2/Database.java
diff options
context:
space:
mode:
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