aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-01 02:15:59 +0200
committerJonas Smedegaard <dr@jones.dk>2025-05-01 02:18:01 +0200
commit94f7348c379f16036e67dce1ad94be274fc84ec8 (patch)
tree8c268fc147e275efc020a4fec963d7feb5f6ef9c
parenta17f4b5b8279488e5c9682b31f0c2d40a6080fbb (diff)
add/update build and zip generation routines
-rw-r--r--Makefile26
-rw-r--r--README.md14
-rw-r--r--database.txt66
-rw-r--r--identifier.sqlitebin20480 -> 16384 bytes
-rw-r--r--report.qmd24
-rw-r--r--src/dk.biks.bachelorizer/identifier.sqlitebin0 -> 16384 bytes
-rw-r--r--src/portfolio1/Activity.java15
-rw-r--r--src/portfolio1/BachelorProject.java8
-rw-r--r--src/portfolio1/BasicCourse.java8
-rw-r--r--src/portfolio1/BasicProject.java8
-rw-r--r--src/portfolio1/Course.java8
-rw-r--r--src/portfolio1/ElectiveCourse.java8
-rw-r--r--src/portfolio1/Main.java39
-rw-r--r--src/portfolio1/MainTest.java42
-rw-r--r--src/portfolio1/Programme.java87
-rw-r--r--src/portfolio1/Project.java8
-rw-r--r--src/portfolio1/SubjectModuleCourse.java8
-rw-r--r--src/portfolio1/SubjectModuleProject.java8
18 files changed, 372 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index d3b753f..7c5cb1c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,22 @@
DOCUMENTS = report
JAVA_PROJECTMODULES = \
- com.example.portfolio2 com.example.portfolio3 dk.biks.bachelorizer
+ com.example.portfolio2 com.example.portfolio3 \
+ portfolio1 dk.biks.bachelorizer
JAVA_MODULEPATHS_portfolio2 = /usr/share/java/sqlite-jdbc.jar
JAVA_ROOT_portfolio2 = src/com.example.portfolio2
JAVA_EXTRACLASSES_portfolio2 = MyDB
JAVA_ROOT_portfolio3 = src/com.example.portfolio3
JAVA_EXTRACLASSES_portfolio3 = AbstractGraph AdjListGraph AdjMapGraph \
Edge EdgeGraph GraphAlgorithms Graph Graphs MatrixGraph Vertex
+JAVA_CLASSPATHS_portfolio1 += \
+ /usr/share/java/junit-platform-console-standalone.jar
+JAVA_ROOT_portfolio1 = src/portfolio1
+JAVA_MAINCLASSES_portfolio1 = Main
+JAVA_EXTRACLASSES_portfolio1 = \
+ Activity BasicCourse Course Programme SubjectModuleCourse \
+ BachelorProject BasicProject ElectiveCourse MainTest Project \
+ SubjectModuleProject
JAVA_MODULEPATHS_bachelorizer = \
/usr/share/openjfx/lib /usr/share/java/sqlite-jdbc.jar
JAVA_ROOT_bachelorizer = src/dk.biks.bachelorizer
@@ -17,7 +26,20 @@ JAVA_EXTRACLASSES_bachelorizer = \
JAVA_MODULES_bachelorizer = $(addprefix javafx.,base controls graphics)
ZIPNAME = bachelorizer
-ZIPFILES += $(STEMS:=.java)
+ZIPFILES += \
+ $(addprefix $(JAVA_ROOT_portfolio2)/com/example/portfolio2/,\
+ $(patsubst %,%.java,$(JAVA_EXTRACLASSES_portfolio2))) \
+ $(addprefix $(JAVA_ROOT_portfolio3)/com/example/portfolio3/,\
+ $(patsubst %,%.java,$(JAVA_EXTRACLASSES_portfolio3))) \
+ $(addprefix $(JAVA_ROOT_portfolio1)/,\
+ $(patsubst %,%.java,\
+ $(JAVA_MAINCLASSES_portfolio1) $(JAVA_EXTRACLASSES_portfolio1))) \
+ $(addprefix $(JAVA_ROOT_bachelorizer)/dk/biks/bachelorizer/,\
+ $(patsubst %,%.java,\
+ $(JAVA_MAINCLASSES_bachelorizer) $(JAVA_EXTRACLASSES_bachelorizer))) \
+ mods/* \
+ README.md identifier.sqlite \
+ Makefile _make/*.mk
include _make/*.mk
diff --git a/README.md b/README.md
index 3db20d1..5260fb1 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,20 @@ Bachelorizer is publicly available as [source].
[source]: <https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z3Xeo1Wg65SQAhD6QFTtVWQmjVHJU>
"Web instance of sources for Bachelorizer"
+## Database creation
+
+The database file `identifier.sqlite` needed by the program
+can be created on a linux system using the command-line tool `sqlite3`
+with the following command:
+
+```shell
+sqlite3 identifier.sqlite < database.txt
+```
+
+Since Intellij executes from a different directory than from commandline,
+the generated database file is then copied
+into the directory `src/dk.biks.bachelorizer`.
+
## Code execution
The code has only been verified to work from command-line
diff --git a/database.txt b/database.txt
new file mode 100644
index 0000000..c4809a5
--- /dev/null
+++ b/database.txt
@@ -0,0 +1,66 @@
+drop table if exists participation;
+drop table if exists student;
+drop table if exists activity;
+
+create table student(name text, studid integer primary key);
+create table activity(indeks integer primary key, ects integer, name text, program text);
+create table participation (
+ studid integer references student(studid),
+ indeks integer references activity(indeks)
+);
+
+insert into activity values(11,5,'BK1 Empirical Data','NatBach');
+insert into activity values(12,5,'BK2 Experimental Methods','NatBach');
+insert into activity values(13,5,'BK3 Theory of Natural Science','NatBach');
+insert into activity values(14,5,'Logic and Discrete Mathematics','NatBach');
+insert into activity values(15,5,'Functional Biology – Zoology','NatBach');
+insert into activity values(16,5,'Linear Algebra','NatBach');
+insert into activity values(17,5,'Organic Chemistry','NatBach');
+insert into activity values(18,5,'Biological Chemistry','NatBach');
+insert into activity values(19,5,'Statistical Models','NatBach');
+insert into activity values(20,5,'Functional Programming and Language Implementations','NatBach');
+insert into activity values(21,5,'Classical Mechanics','NatBach');
+insert into activity values(22,5,'Environmental Science','NatBach');
+insert into activity values(23,5,'Cell Biology','NatBach');
+insert into activity values(24,5,'Functional biology – Botany','NatBach');
+insert into activity values(25,5,'Supplementary Physics','NatBach');
+insert into activity values(26,5,'Calculus','NatBach');
+insert into activity values(27,5,'The Chemical Reaction','NatBach');
+insert into activity values(28,5,'Scientific Computing','NatBach');
+insert into activity values(29,5,'Energy and Climate Changes','NatBach');
+insert into activity values(30,5,'BP1 NatBach','NatBach');
+insert into activity values(31,5,'BP2 NatBach','NatBach');
+insert into activity values(32,5,'BP3 NatBach','NatBach');
+insert into activity values(33,5,'Bachelorproject NatBach','NatBach');
+insert into activity values(34,5,'Design og Konstruktion I+Workshop','HumTek');
+insert into activity values(35,5,'Subjektivitet, Teknologi og Samfund I','HumTek');
+insert into activity values(36,5,'Teknologiske systemer og artefakter I','HumTek');
+insert into activity values(37,5,'Videnskabsteori','HumTek');
+insert into activity values(38,5,'Design og Konstruktion II+Workshop','HumTek');
+insert into activity values(39,5,'Subjektivitet, Teknologi og Samfund II','HumTek');
+insert into activity values(40,5,'Bæredygtige teknologier','HumTek');
+insert into activity values(41,5,'Kunstig intelligens','HumTek');
+insert into activity values(42,5,'Medier og teknologi - datavisualisering','HumTek');
+insert into activity values(43,5,'Teknologiske Systemer og Artefakter II - Sundhedsteknologi','HumTek');
+insert into activity values(44,5,'Den (in)humane storby','HumTek');
+insert into activity values(45,5,'Interactive Design in the Field','HumTek');
+insert into activity values(46,5,'Organisation og ledelse af designprocesser','HumTek');
+insert into activity values(47,5,'BP1 HumTek','HumTek');
+insert into activity values(48,5,'BP2 HumTek','HumTek');
+insert into activity values(49,5,'BP3 HumTek','HumTek');
+insert into activity values(50,5,'Bachelorproject HumTek','HumTek');
+insert into activity values(51,5,'Essential Computing','Computer Science');
+insert into activity values(52,10,'Software Development','Computer Science');
+insert into activity values(53,5,'Interactive Digital Systems','Computer Science');
+insert into activity values(54,5,'Subject module project in Computer Science','Computer Science');
+insert into activity values(55,5,'Organisatorisk forandring og IT','Informatik');
+insert into activity values(56,10,'BANDIT','Informatik');
+insert into activity values(57,5,'Web baserede IT-Systemer','Informatik');
+insert into activity values(58,5,'Subject module project in Informatik','Informatik');
+insert into activity values(59,5,'Essential Astrology','Astrology');
+insert into activity values(60,5,'Venus studies','Astrology');
+insert into activity values(61,5,'Mars studies','Astrology');
+insert into activity values(62,5,'Ascendant calculations','Astrology');
+insert into activity values(63,5,'Subject module project in Astrology','Astrology');
+
+insert into student values ('Ian', 123);
diff --git a/identifier.sqlite b/identifier.sqlite
index 25bef36..9a1db4f 100644
--- a/identifier.sqlite
+++ b/identifier.sqlite
Binary files differ
diff --git a/report.qmd b/report.qmd
index 519b0bd..703c0ec 100644
--- a/report.qmd
+++ b/report.qmd
@@ -25,8 +25,19 @@ breaks: false
# General notes
-This text covers the code project `com.biks.bachelorizer`
-that was authored with contributions from several groups
+This report covers the two code projects
+`portfolio1` and `dk.biks.bachelorizer`.
+
+`portfolio1`
+was authored with contributions from several groups
+involving the students
+Asger Adam Væver Johansen,
+Alexander Marthin Klemensen,
+Ian Valentin Christensen
+and Jonas Smedegaard.
+
+`dk.biks.bachelorizer`
+was authored with contributions from several groups
involving the students
Alexander Marthin Klemensen,
Ian Valentin Christensen,
@@ -35,7 +46,14 @@ and Zahed Noos.
Copyright statements at the top of the code files
reflects from whom each file received contributions.
-With the code project is included two additional projects,
+With the code project is included compiled class files,
+the make files used to compile,
+an SQL script `database.txt`,
+a pregenerated SQLite3 database file `identifier.sqlite`
+(duplicated to cover use from command-line and in intellij)
+and a README.md file documenting compilation and execution.
+
+Also included with the code projects are two projects,
`com.example.portfolio2` and `com.example.portfolio3`,
derived from @Rosendahl2025.12 and @Rosendahl2025.16, respectively.
diff --git a/src/dk.biks.bachelorizer/identifier.sqlite b/src/dk.biks.bachelorizer/identifier.sqlite
new file mode 100644
index 0000000..9a1db4f
--- /dev/null
+++ b/src/dk.biks.bachelorizer/identifier.sqlite
Binary files differ
diff --git a/src/portfolio1/Activity.java b/src/portfolio1/Activity.java
new file mode 100644
index 0000000..0f5c929
--- /dev/null
+++ b/src/portfolio1/Activity.java
@@ -0,0 +1,15 @@
+public abstract class Activity {
+ int ects;
+ String name;
+ public Activity(int ects, String name) {
+ this.ects = ects;
+ this.name = name;
+ }
+ public String toString(){
+ return name + ", " + ects + " ECTS";
+ }
+
+ public int getEcts(){
+ return this.ects;
+ }
+}
diff --git a/src/portfolio1/BachelorProject.java b/src/portfolio1/BachelorProject.java
new file mode 100644
index 0000000..3c2e7ec
--- /dev/null
+++ b/src/portfolio1/BachelorProject.java
@@ -0,0 +1,8 @@
+public class BachelorProject extends Project {
+ public BachelorProject(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Bachelor " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/BasicCourse.java b/src/portfolio1/BasicCourse.java
new file mode 100644
index 0000000..bf3e64b
--- /dev/null
+++ b/src/portfolio1/BasicCourse.java
@@ -0,0 +1,8 @@
+public class BasicCourse extends Course {
+ public BasicCourse(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Basic " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/BasicProject.java b/src/portfolio1/BasicProject.java
new file mode 100644
index 0000000..4017577
--- /dev/null
+++ b/src/portfolio1/BasicProject.java
@@ -0,0 +1,8 @@
+public class BasicProject extends Project {
+ public BasicProject(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Basic " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/Course.java b/src/portfolio1/Course.java
new file mode 100644
index 0000000..66acd3f
--- /dev/null
+++ b/src/portfolio1/Course.java
@@ -0,0 +1,8 @@
+public class Course extends Activity {
+ public Course(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Course: " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/ElectiveCourse.java b/src/portfolio1/ElectiveCourse.java
new file mode 100644
index 0000000..6b23c84
--- /dev/null
+++ b/src/portfolio1/ElectiveCourse.java
@@ -0,0 +1,8 @@
+public class ElectiveCourse extends Course {
+ public ElectiveCourse(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Elective " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/Main.java b/src/portfolio1/Main.java
new file mode 100644
index 0000000..8bb4482
--- /dev/null
+++ b/src/portfolio1/Main.java
@@ -0,0 +1,39 @@
+public class Main {
+ public static void main(String[] args) {
+ Programme HumTek = new Programme();
+ // adds courses and projects to arraylist
+ HumTek.add(
+ // semester 1
+ new BasicCourse(5, "Design"),
+ new BasicCourse(5, "Design og Bæredygtighed"),
+ new BasicCourse(5, "Mennesker og Teknologi"),
+ new BasicProject(15, "BP1: Projekt med fokus på design"),
+ // semester 2
+ new BasicCourse(5, "Teknologi"),
+ new BasicCourse(5, "Temakursus i teknologi"),
+ new BasicCourse(5, "Mennesker, teknologi og samfund"),
+ new BasicProject(15, "BP2: Projekt med fokus på teknologi"),
+ // semester 3
+ new SubjectModuleCourse(5, "Essential computing"),
+ new SubjectModuleCourse(5, "Filosofi- og videnskabshistorie indtil 1600"),
+ new BasicCourse(5, "Videnskabsteori"),
+ new BasicProject(15, "BP3: Projekt med fokus på mennesker og teknologi"),
+ // semester 4
+ new SubjectModuleCourse(5, "Interactive digital systems"),
+ new SubjectModuleCourse(10, "Software development"),
+ new SubjectModuleProject(15, "Subject module project in computer science"),
+ // semester 5
+ new SubjectModuleCourse(5, "Filosofihistorie 1600-1900"),
+ new SubjectModuleCourse(5, "Etik og politisk filosofi"),
+ new SubjectModuleCourse(5, "Metafysik og erkendelseteori"),
+ new SubjectModuleProject(15, "Fagmodulprojekt i filosofi og videnskabsteori"),
+ // semester 6
+ new ElectiveCourse(5, "Valgfrit kursus 1"),
+ new ElectiveCourse(5, "Valgfrit kursus 2"),
+ new BasicCourse(5, "Profilkursus"),
+ new BachelorProject(15, "Bachelorprojekt")
+ );
+ System.out.println(HumTek);
+ if (HumTek.isValid()){System.out.println("We good");}
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/MainTest.java b/src/portfolio1/MainTest.java
new file mode 100644
index 0000000..2901ef9
--- /dev/null
+++ b/src/portfolio1/MainTest.java
@@ -0,0 +1,42 @@
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class MainTest {
+
+ @Test
+ void testValid() {
+ Programme testProg = new Programme();
+ for (int i = 0; i < 18; i++) {
+ testProg.add(new Course(5, "course " + i));
+ }
+ for (int j = 0; j < 6; j++) {
+ testProg.add(new Project(15, "project " + j));
+ }
+ assertEquals(false, testProg.isValid());
+ }
+
+ @Test
+ void testCorrectProgramme() {
+ Programme testProg = new Programme();
+ for (int i = 0; i < 8; i++) {
+ testProg.add(new BasicCourse(5, "Basic Course " + i));
+ }
+ for (int j = 0; j < 3; j++) {
+ testProg.add(new BasicProject(15, "Basic Project " + j));
+ }
+ for (int i = 0; i < 8; i++) {
+ testProg.add(new SubjectModuleCourse(5, "Subject Module Course " + i));
+ }
+ for (int i = 0; i < 2; i++) {
+ testProg.add(new SubjectModuleProject(15, "Subject Module Project " + i));
+ }
+ for (int i = 0; i < 2; i++) {
+ testProg.add(new ElectiveCourse(5, "Elective Course " + i));
+ }
+ testProg.add(new BachelorProject(15, "Bachelor Project"));
+ assertEquals(true, testProg.isValid());
+ }
+
+}
+
diff --git a/src/portfolio1/Programme.java b/src/portfolio1/Programme.java
new file mode 100644
index 0000000..8847c89
--- /dev/null
+++ b/src/portfolio1/Programme.java
@@ -0,0 +1,87 @@
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class Programme {
+ static ArrayList<Activity> activities = new ArrayList<>();
+
+ public Programme() {
+ // Reset the activities list when a new Programme is created
+ activities.clear();
+ }
+
+ // Performs a check to see if the programme is valid
+ public boolean isValid() {
+ //Initializes variables we need to test
+ int sumProject = 0;
+ int sumCourse = 0;
+ int sumBasicCourse = 0;
+ int countSubjectModuleProject = 0;
+ int sumSubjectModuleCourse = 0;
+ int countBachelorProject = 0;
+ int countBasicProject = 0;
+ int sumElectiveCourse = 0;
+
+ //The program looks through every activity in the programme list and checks for specific classes
+ for (Activity activity : activities) {
+ String activityString = activity.toString();
+
+ // Check for specific types based on toString() output
+ if (activityString.startsWith("Basic Course:")) {
+ sumBasicCourse += activity.getEcts();
+ sumCourse += activity.getEcts();
+ } else if (activityString.startsWith("Subject Module Course:")) {
+ sumSubjectModuleCourse += activity.getEcts();
+ sumCourse += activity.getEcts();
+ } else if (activityString.startsWith("Elective Course:")) {
+ sumElectiveCourse += activity.getEcts();
+ sumCourse += activity.getEcts();
+ } else if (activityString.startsWith("Course:")) {
+ sumCourse += activity.getEcts();
+ } else if (activityString.startsWith("Bachelor Project:")) {
+ countBachelorProject += 1;
+ sumProject += activity.getEcts();
+ } else if (activityString.startsWith("Subject Module Project:")) {
+ countSubjectModuleProject++;
+ sumProject += activity.getEcts();
+ } else if (activityString.startsWith("Basic Project:")) {
+ countBasicProject++;
+ sumProject += activity.getEcts();
+ } else if (activityString.startsWith("Project:")) {
+ sumProject += activity.getEcts();
+ }
+ }
+
+ //It returns a boolean depending on the parameters are correct
+ /* A valid programme must have activities from two subject modules,
+ three basic projects, a bachelor project,
+ and a further 50 ECTS of courses where at least 40 ECTS are basic courses.
+ In a valid programme no activity can appear twice */
+
+ return (
+ sumCourse == 90
+ && sumProject == 90
+ && sumBasicCourse == 40
+ && countSubjectModuleProject == 2
+ && sumSubjectModuleCourse == 40
+ && countBachelorProject == 1);
+
+ }
+
+ public void add(Activity... activitiesArray) {
+ for (Activity e : activitiesArray) {
+ this.activities.add(e);
+ }
+ }
+
+ public String toString() {
+ StringBuilder ret = new StringBuilder();
+ Iterator<Activity> it = activities.iterator();
+ while (it.hasNext()) {
+ ret.append(it.next());
+ if (it.hasNext()) {
+ ret.append(System.lineSeparator());
+ }
+ }
+ return ret.toString();
+ }
+}
diff --git a/src/portfolio1/Project.java b/src/portfolio1/Project.java
new file mode 100644
index 0000000..c56fd86
--- /dev/null
+++ b/src/portfolio1/Project.java
@@ -0,0 +1,8 @@
+public class Project extends Activity {
+ public Project(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Project: " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/SubjectModuleCourse.java b/src/portfolio1/SubjectModuleCourse.java
new file mode 100644
index 0000000..64cd81b
--- /dev/null
+++ b/src/portfolio1/SubjectModuleCourse.java
@@ -0,0 +1,8 @@
+public class SubjectModuleCourse extends Course {
+ public SubjectModuleCourse(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Subject Module " + super.toString();
+ }
+} \ No newline at end of file
diff --git a/src/portfolio1/SubjectModuleProject.java b/src/portfolio1/SubjectModuleProject.java
new file mode 100644
index 0000000..f44884c
--- /dev/null
+++ b/src/portfolio1/SubjectModuleProject.java
@@ -0,0 +1,8 @@
+public class SubjectModuleProject extends Project {
+ public SubjectModuleProject(int ects, String name) {
+ super(ects, name);
+ }
+ public String toString() {
+ return "Subject Module " + super.toString();
+ }
+} \ No newline at end of file