From 1ab3e8a05d181d0fd36f08e451f068a429c841b2 Mon Sep 17 00:00:00 2001
From: Hallvard Traetteberg <hal@ntnu.no>
Date: Mon, 6 Sep 2021 13:30:58 +0200
Subject: [PATCH] module-info.java i modules-template

---
 javafx-template/src/main/java/app/Calc.java          | 2 +-
 modules-template/core/src/main/java/core/Calc.java   | 4 ++++
 modules-template/core/src/main/java/module-info.java | 3 +++
 modules-template/ui/src/main/java/module-info.java   | 7 +++++++
 packages-template/src/main/java/core/Calc.java       | 4 ++++
 5 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 modules-template/core/src/main/java/module-info.java
 create mode 100644 modules-template/ui/src/main/java/module-info.java

diff --git a/javafx-template/src/main/java/app/Calc.java b/javafx-template/src/main/java/app/Calc.java
index 6c740f4..6f00f37 100644
--- a/javafx-template/src/main/java/app/Calc.java
+++ b/javafx-template/src/main/java/app/Calc.java
@@ -102,7 +102,7 @@ public class Calc {
      * @throws IllegalStateException if the operand count is less than two
      */
     public void swap() {
-        
+        // TODO        
     }
 
     /**
diff --git a/modules-template/core/src/main/java/core/Calc.java b/modules-template/core/src/main/java/core/Calc.java
index ed63b11..0e97f32 100644
--- a/modules-template/core/src/main/java/core/Calc.java
+++ b/modules-template/core/src/main/java/core/Calc.java
@@ -94,6 +94,8 @@ public class Calc {
 
     /**
      * Swaps the two topmost operands.
+     *
+     * @throws IllegalStateException if the operand count is less than two
      */
     public void swap() {
         // TODO
@@ -101,6 +103,8 @@ public class Calc {
 
     /**
      * Duplicates the top operand.
+     *
+     * @throws IllegalStateException if the operand stack is empty
      */
     public void dup() {
         // TODO
diff --git a/modules-template/core/src/main/java/module-info.java b/modules-template/core/src/main/java/module-info.java
new file mode 100644
index 0000000..b152a46
--- /dev/null
+++ b/modules-template/core/src/main/java/module-info.java
@@ -0,0 +1,3 @@
+module calc.core {
+    exports core;
+}
diff --git a/modules-template/ui/src/main/java/module-info.java b/modules-template/ui/src/main/java/module-info.java
new file mode 100644
index 0000000..efb377c
--- /dev/null
+++ b/modules-template/ui/src/main/java/module-info.java
@@ -0,0 +1,7 @@
+module calc.ui {
+    requires calc.core;
+    requires javafx.controls;
+    requires javafx.fxml;
+
+    opens ui to javafx.graphics, javafx.fxml;
+}
diff --git a/packages-template/src/main/java/core/Calc.java b/packages-template/src/main/java/core/Calc.java
index ed63b11..0e97f32 100644
--- a/packages-template/src/main/java/core/Calc.java
+++ b/packages-template/src/main/java/core/Calc.java
@@ -94,6 +94,8 @@ public class Calc {
 
     /**
      * Swaps the two topmost operands.
+     *
+     * @throws IllegalStateException if the operand count is less than two
      */
     public void swap() {
         // TODO
@@ -101,6 +103,8 @@ public class Calc {
 
     /**
      * Duplicates the top operand.
+     *
+     * @throws IllegalStateException if the operand stack is empty
      */
     public void dup() {
         // TODO
-- 
GitLab