From b643a36ab5d5ce93a529d43fbf61ff58ec0b993d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hallvard=20Tr=C3=A6tteberg?= Date: Wed, 18 Aug 2021 14:53:22 +0000 Subject: [PATCH] Laget to varianter til og la til flere tester --- .vscode/settings.json | 3 + javafx-template/src/main/java/app/Calc.java | 8 ++ .../src/test/java/app/CalcTest.java | 75 ++++++++++ modules-template/.gitignore | 2 + modules-template/core/pom.xml | 43 ++++++ .../core/src/main/java/core/Calc.java | 108 ++++++++++++++ .../core/src/test/java/core/CalcTest.java | 114 +++++++++++++++ modules-template/pom.xml | 62 ++++++++ modules-template/src/main/java/core/Calc.java | 108 ++++++++++++++ .../src/test/java/core/CalcTest.java | 39 +++++ modules-template/ui/pom.xml | 98 +++++++++++++ modules-template/ui/src/main/java/ui/App.java | 27 ++++ .../ui/src/main/java/ui/AppController.java | 135 ++++++++++++++++++ .../ui/src/main/resources/ui/App.fxml | 64 +++++++++ .../ui/src/test/java/ui/AppTest.java | 130 +++++++++++++++++ .../ui/src/test/java/ui/README.md | 38 +++++ packages-template/.gitignore | 2 + packages-template/pom.xml | 103 +++++++++++++ .../src/main/java/core/Calc.java | 108 ++++++++++++++ packages-template/src/main/java/ui/App.java | 27 ++++ .../src/main/java/ui/AppController.java | 135 ++++++++++++++++++ .../src/main/resources/ui/App.fxml | 64 +++++++++ .../src/test/java/core/CalcTest.java | 114 +++++++++++++++ .../src/test/java/ui/AppTest.java | 130 +++++++++++++++++ packages-template/src/test/java/ui/README.md | 38 +++++ 25 files changed, 1775 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 modules-template/.gitignore create mode 100644 modules-template/core/pom.xml create mode 100644 modules-template/core/src/main/java/core/Calc.java create mode 100644 modules-template/core/src/test/java/core/CalcTest.java create mode 100644 modules-template/pom.xml create mode 100644 modules-template/src/main/java/core/Calc.java create mode 100644 modules-template/src/test/java/core/CalcTest.java create mode 100644 modules-template/ui/pom.xml create mode 100644 modules-template/ui/src/main/java/ui/App.java create mode 100644 modules-template/ui/src/main/java/ui/AppController.java create mode 100644 modules-template/ui/src/main/resources/ui/App.fxml create mode 100644 modules-template/ui/src/test/java/ui/AppTest.java create mode 100644 modules-template/ui/src/test/java/ui/README.md create mode 100644 packages-template/.gitignore create mode 100644 packages-template/pom.xml create mode 100644 packages-template/src/main/java/core/Calc.java create mode 100644 packages-template/src/main/java/ui/App.java create mode 100644 packages-template/src/main/java/ui/AppController.java create mode 100644 packages-template/src/main/resources/ui/App.fxml create mode 100644 packages-template/src/test/java/core/CalcTest.java create mode 100644 packages-template/src/test/java/ui/AppTest.java create mode 100644 packages-template/src/test/java/ui/README.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e0f15db --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic" +} \ No newline at end of file diff --git a/javafx-template/src/main/java/app/Calc.java b/javafx-template/src/main/java/app/Calc.java index 8ff70b8..1f0c5c8 100644 --- a/javafx-template/src/main/java/app/Calc.java +++ b/javafx-template/src/main/java/app/Calc.java @@ -25,6 +25,7 @@ public class Calc { /** * Pushes a new operand onto top of the stack. + * * @param d the new operand */ public void pushOperand(double d) { @@ -52,6 +53,7 @@ public class Calc { /** * Removes and returns the top operand. + * * @return the top operand * @throws IllegalStateException if the stack is empty */ @@ -65,6 +67,7 @@ public class Calc { /** * Performs the provided operation in the top operand, and * replaces it with the result. + * * @param op the operation to perform * @return the result of performing the operation * @throws IllegalStateException if the operand stack is empty @@ -77,6 +80,7 @@ public class Calc { /** * Performs the provided operation in the two topmost operands, and * replaces them with the result. + * * @param op the operation to perform * @return the result of performing the operation * @throws IllegalStateException if the operand count is less than two @@ -94,6 +98,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 +107,8 @@ public class Calc { /** * Duplicates the top operand. + * + * @throws IllegalStateException if the operand stack is empty */ public void dup() { // TODO diff --git a/javafx-template/src/test/java/app/CalcTest.java b/javafx-template/src/test/java/app/CalcTest.java index 9a7c0df..28064cf 100644 --- a/javafx-template/src/test/java/app/CalcTest.java +++ b/javafx-template/src/test/java/app/CalcTest.java @@ -28,6 +28,21 @@ public class CalcTest { checkCalc(calc, 3.14, 1.0); } + @Test + public void testPeekOperand() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.peekOperand()); + Assertions.assertThrows(IllegalArgumentException.class, () -> new Calc().peekOperand()); + } + + @Test + public void testPeekOperandN() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.peekOperand(0)); + Assertions.assertEquals(1.0, calc.peekOperand(1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> calc.peekOperand(2)); + } + @Test public void testPopOperand() { Calc calc = new Calc(1.0, 3.14); @@ -36,4 +51,64 @@ public class CalcTest { Assertions.assertEquals(1.0, calc.popOperand()); checkCalc(calc); } + + @Test + public void testPopOperand_emptyStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().popOperand()); + } + + @Test + public void testPerformOperation1() { + Calc calc = new Calc(1.0); + Assertions.assertEquals(-1.0, calc.performOperation(n -> -n)); + checkCalc(calc, -1.0); + } + + @Test + public void testPerformOperation1_emptyOperandStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().performOperation(n -> -n)); + } + + + @Test + public void testPerformOperation2() { + Calc calc = new Calc(1.0, 3.0); + Assertions.assertEquals(-2.0, calc.performOperation((n1, n2) -> n1 - n2)); + checkCalc(calc, -2.0); + } + + @Test + public void testPerformOperation2_lessThanTwoOperands() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc(1.0).performOperation((n1, n2) -> n1 - n2)); + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().performOperation((n1, n2) -> n1 - n2)); + } + + @Test + public void testSwap() { + Calc calc = new Calc(1.0, 3.14); + calc.swap(); + checkCalc(calc, 3.14, 1.0); + calc.swap(); + checkCalc(calc, 1.0, 3.14); + } + + @Test + public void testSwap_lessThanTwoOperands() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc(1.0).swap()); + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().swap()); + } + + @Test + public void testDup() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.popOperand()); + checkCalc(calc, 1.0); + Assertions.assertEquals(1.0, calc.popOperand()); + checkCalc(calc); + } + + @Test + public void testDup_emptyOperandStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().dup()); + } } diff --git a/modules-template/.gitignore b/modules-template/.gitignore new file mode 100644 index 0000000..2131639 --- /dev/null +++ b/modules-template/.gitignore @@ -0,0 +1,2 @@ +# ignore maven build folder +target/ diff --git a/modules-template/core/pom.xml b/modules-template/core/pom.xml new file mode 100644 index 0000000..abaca3e --- /dev/null +++ b/modules-template/core/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + it1901 + modules-core + + + it1901 + modules-template + 0.0.1-SNAPSHOT + .. + + + + + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-params + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/modules-template/core/src/main/java/core/Calc.java b/modules-template/core/src/main/java/core/Calc.java new file mode 100644 index 0000000..f50679d --- /dev/null +++ b/modules-template/core/src/main/java/core/Calc.java @@ -0,0 +1,108 @@ +package core; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BinaryOperator; +import java.util.function.UnaryOperator; + +public class Calc { + + private final List operandStack; + + public Calc(double... operands) { + operandStack = new ArrayList<>(operands.length + 2); + for (var d : operands) { + operandStack.add(d); + } + } + + /** + * @return the number of operands on the stack + */ + public int getOperandCount() { + return operandStack.size(); + } + + /** + * Pushes a new operand onto top of the stack. + * @param d the new operand + */ + public void pushOperand(double d) { + operandStack.add(d); + } + + /** + * @param n the place (from the top) to peek + * @return the n'th operand from the top + * @throws IllegalArgumentException if n is larger than the operand count + */ + public double peekOperand(int n) { + if (n > getOperandCount()) { + throw new IllegalArgumentException("Cannot peek at position " + n + " when the operand count is " + getOperandCount()); + } + return operandStack.get(getOperandCount() - n - 1); + } + + /** + * @return the top operand + */ + public double peekOperand() { + return peekOperand(0); + } + + /** + * Removes and returns the top operand. + * @return the top operand + * @throws IllegalStateException if the stack is empty + */ + public double popOperand() { + if (getOperandCount() == 0) { + throw new IllegalStateException("Cannot pop from an empty stack"); + } + return operandStack.remove(operandStack.size() - 1); + } + + /** + * Performs the provided operation in the top operand, and + * replaces it with the result. + * @param op the operation to perform + * @return the result of performing the operation + * @throws IllegalStateException if the operand stack is empty + */ + public double performOperation(UnaryOperator op) throws IllegalStateException { + // TODO + return 0.0; + } + + /** + * Performs the provided operation in the two topmost operands, and + * replaces them with the result. + * @param op the operation to perform + * @return the result of performing the operation + * @throws IllegalStateException if the operand count is less than two + */ + public double performOperation(BinaryOperator op) throws IllegalStateException { + if (getOperandCount() < 2) { + throw new IllegalStateException("Too few operands (" + getOperandCount() + ") on the stack"); + } + var op1 = popOperand(); + var op2 = popOperand(); + var result = op.apply(op1, op2); + pushOperand(result); + return result; + } + + /** + * Swaps the two topmost operands. + */ + public void swap() { + // TODO + } + + /** + * Duplicates the top operand. + */ + public void dup() { + // TODO + } +} \ No newline at end of file diff --git a/modules-template/core/src/test/java/core/CalcTest.java b/modules-template/core/src/test/java/core/CalcTest.java new file mode 100644 index 0000000..0207cd5 --- /dev/null +++ b/modules-template/core/src/test/java/core/CalcTest.java @@ -0,0 +1,114 @@ +package core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class CalcTest { + + private static void checkCalc(Calc calc, double... operands) { + Assertions.assertEquals(operands.length, calc.getOperandCount(), "Wrong operand count"); + for (int i = 0; i < operands.length; i++) { + Assertions.assertEquals(operands[i], calc.peekOperand(i), "Wrong value at #" + i + " of operand stack"); + } + } + + @Test + public void testCalc() { + checkCalc(new Calc()); + checkCalc(new Calc(1.0), 1.0); + checkCalc(new Calc(3.14, 1.0), 1.0, 3.14); + } + + @Test + public void testPushOperand() { + Calc calc = new Calc(); + calc.pushOperand(1.0); + checkCalc(calc, 1.0); + calc.pushOperand(3.14); + checkCalc(calc, 3.14, 1.0); + } + + @Test + public void testPeekOperand() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.peekOperand()); + Assertions.assertThrows(IllegalArgumentException.class, () -> new Calc().peekOperand()); + } + + @Test + public void testPeekOperandN() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.peekOperand(0)); + Assertions.assertEquals(1.0, calc.peekOperand(1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> calc.peekOperand(2)); + } + + @Test + public void testPopOperand() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.popOperand()); + checkCalc(calc, 1.0); + Assertions.assertEquals(1.0, calc.popOperand()); + checkCalc(calc); + } + + @Test + public void testPopOperand_emptyStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().popOperand()); + } + + @Test + public void testPerformOperation1() { + Calc calc = new Calc(1.0); + Assertions.assertEquals(-1.0, calc.performOperation(n -> -n)); + checkCalc(calc, -1.0); + } + + @Test + public void testPerformOperation1_emptyOperandStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().performOperation(n -> -n)); + } + + + @Test + public void testPerformOperation2() { + Calc calc = new Calc(1.0, 3.0); + Assertions.assertEquals(-2.0, calc.performOperation((n1, n2) -> n1 - n2)); + checkCalc(calc, -2.0); + } + + @Test + public void testPerformOperation2_lessThanTwoOperands() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc(1.0).performOperation((n1, n2) -> n1 - n2)); + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().performOperation((n1, n2) -> n1 - n2)); + } + + @Test + public void testSwap() { + Calc calc = new Calc(1.0, 3.14); + calc.swap(); + checkCalc(calc, 3.14, 1.0); + calc.swap(); + checkCalc(calc, 1.0, 3.14); + } + + @Test + public void testSwap_lessThanTwoOperands() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc(1.0).swap()); + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().swap()); + } + + @Test + public void testDup() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.popOperand()); + checkCalc(calc, 1.0); + Assertions.assertEquals(1.0, calc.popOperand()); + checkCalc(calc); + } + + @Test + public void testDup_emptyOperandStack() { + Assertions.assertThrows(IllegalStateException.class, () -> new Calc().dup()); + } +} diff --git a/modules-template/pom.xml b/modules-template/pom.xml new file mode 100644 index 0000000..f0e8d58 --- /dev/null +++ b/modules-template/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + it1901 + modules-template + 0.0.1-SNAPSHOT + pom + + + UTF-8 + 16 + 16 + + + + + + org.junit.jupiter + junit-jupiter-api + 5.7.2 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.7.2 + test + + + org.junit.jupiter + junit-jupiter-params + 5.7.2 + test + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 16 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + + + + + core + ui + + diff --git a/modules-template/src/main/java/core/Calc.java b/modules-template/src/main/java/core/Calc.java new file mode 100644 index 0000000..f50679d --- /dev/null +++ b/modules-template/src/main/java/core/Calc.java @@ -0,0 +1,108 @@ +package core; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BinaryOperator; +import java.util.function.UnaryOperator; + +public class Calc { + + private final List operandStack; + + public Calc(double... operands) { + operandStack = new ArrayList<>(operands.length + 2); + for (var d : operands) { + operandStack.add(d); + } + } + + /** + * @return the number of operands on the stack + */ + public int getOperandCount() { + return operandStack.size(); + } + + /** + * Pushes a new operand onto top of the stack. + * @param d the new operand + */ + public void pushOperand(double d) { + operandStack.add(d); + } + + /** + * @param n the place (from the top) to peek + * @return the n'th operand from the top + * @throws IllegalArgumentException if n is larger than the operand count + */ + public double peekOperand(int n) { + if (n > getOperandCount()) { + throw new IllegalArgumentException("Cannot peek at position " + n + " when the operand count is " + getOperandCount()); + } + return operandStack.get(getOperandCount() - n - 1); + } + + /** + * @return the top operand + */ + public double peekOperand() { + return peekOperand(0); + } + + /** + * Removes and returns the top operand. + * @return the top operand + * @throws IllegalStateException if the stack is empty + */ + public double popOperand() { + if (getOperandCount() == 0) { + throw new IllegalStateException("Cannot pop from an empty stack"); + } + return operandStack.remove(operandStack.size() - 1); + } + + /** + * Performs the provided operation in the top operand, and + * replaces it with the result. + * @param op the operation to perform + * @return the result of performing the operation + * @throws IllegalStateException if the operand stack is empty + */ + public double performOperation(UnaryOperator op) throws IllegalStateException { + // TODO + return 0.0; + } + + /** + * Performs the provided operation in the two topmost operands, and + * replaces them with the result. + * @param op the operation to perform + * @return the result of performing the operation + * @throws IllegalStateException if the operand count is less than two + */ + public double performOperation(BinaryOperator op) throws IllegalStateException { + if (getOperandCount() < 2) { + throw new IllegalStateException("Too few operands (" + getOperandCount() + ") on the stack"); + } + var op1 = popOperand(); + var op2 = popOperand(); + var result = op.apply(op1, op2); + pushOperand(result); + return result; + } + + /** + * Swaps the two topmost operands. + */ + public void swap() { + // TODO + } + + /** + * Duplicates the top operand. + */ + public void dup() { + // TODO + } +} \ No newline at end of file diff --git a/modules-template/src/test/java/core/CalcTest.java b/modules-template/src/test/java/core/CalcTest.java new file mode 100644 index 0000000..dc95b0d --- /dev/null +++ b/modules-template/src/test/java/core/CalcTest.java @@ -0,0 +1,39 @@ +package core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class CalcTest { + + private static void checkCalc(Calc calc, double... operands) { + Assertions.assertEquals(operands.length, calc.getOperandCount(), "Wrong operand count"); + for (int i = 0; i < operands.length; i++) { + Assertions.assertEquals(operands[i], calc.peekOperand(i), "Wrong value at #" + i + " of operand stack"); + } + } + + @Test + public void testCalc() { + checkCalc(new Calc()); + checkCalc(new Calc(1.0), 1.0); + checkCalc(new Calc(3.14, 1.0), 1.0, 3.14); + } + + @Test + public void testPushOperand() { + Calc calc = new Calc(); + calc.pushOperand(1.0); + checkCalc(calc, 1.0); + calc.pushOperand(3.14); + checkCalc(calc, 3.14, 1.0); + } + + @Test + public void testPopOperand() { + Calc calc = new Calc(1.0, 3.14); + Assertions.assertEquals(3.14, calc.popOperand()); + checkCalc(calc, 1.0); + Assertions.assertEquals(1.0, calc.popOperand()); + checkCalc(calc); + } +} diff --git a/modules-template/ui/pom.xml b/modules-template/ui/pom.xml new file mode 100644 index 0000000..45f4dec --- /dev/null +++ b/modules-template/ui/pom.xml @@ -0,0 +1,98 @@ + + 4.0.0 + it1901 + modules-ui + + + it1901 + modules-template + 0.0.1-SNAPSHOT + .. + + + + + + it1901 + modules-core + 0.0.1-SNAPSHOT + + + + + org.openjfx + javafx-controls + 16 + + + org.openjfx + javafx-fxml + 16 + + + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-params + + + + + org.testfx + testfx-core + 4.0.16-alpha + test + + + org.testfx + testfx-junit5 + 4.0.16-alpha + test + + + org.hamcrest + hamcrest + 2.2 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + ui.App + + + + + + + diff --git a/modules-template/ui/src/main/java/ui/App.java b/modules-template/ui/src/main/java/ui/App.java new file mode 100644 index 0000000..acead69 --- /dev/null +++ b/modules-template/ui/src/main/java/ui/App.java @@ -0,0 +1,27 @@ +package ui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +/** + * JavaFX App + */ +public class App extends Application { + + @Override + public void start(Stage stage) throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("App.fxml")); + Parent parent = fxmlLoader.load(); + stage.setScene(new Scene(parent)); + stage.show(); + } + + public static void main(String[] args) { + launch(); + } +} \ No newline at end of file diff --git a/modules-template/ui/src/main/java/ui/AppController.java b/modules-template/ui/src/main/java/ui/AppController.java new file mode 100644 index 0000000..2002d48 --- /dev/null +++ b/modules-template/ui/src/main/java/ui/AppController.java @@ -0,0 +1,135 @@ +package ui; + +import core.Calc; + +import java.util.List; +import java.util.function.BinaryOperator; +import java.util.function.UnaryOperator; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.control.Labeled; +import javafx.scene.control.ListView; + +public class AppController { + + private Calc calc; + + public AppController() { + calc = new Calc(0.0, 0.0, 0.0); + } + + public Calc getCalc() { + return calc; + } + + public void setCalc(Calc calc) { + this.calc = calc; + updateOperandsView(); + } + + @FXML + private ListView operandsView; + + @FXML + private Label operandView; + + @FXML + void initialize() { + updateOperandsView(); + } + + private void updateOperandsView() { + List operands = operandsView.getItems(); + operands.clear(); + int elementCount = Math.min(calc.getOperandCount(), 3); + for (int i = 0; i < elementCount; i++) { + operands.add(calc.peekOperand(elementCount - i - 1)); + } + } + + private String getOperandString() { + return operandView.getText(); + } + + private boolean hasOperand() { + return ! getOperandString().isBlank(); + } + + private double getOperand() { + return Double.valueOf(operandView.getText()); + } + + private void setOperand(String operandString) { + operandView.setText(operandString); + } + + @FXML + void handleEnter() { + if (hasOperand()) { + calc.pushOperand(getOperand()); + } else { + calc.dup(); + } + setOperand(""); + updateOperandsView(); + } + + private void appendToOperand(String s) { + // TODO + } + + @FXML + void handleDigit(ActionEvent ae) { + if (ae.getSource() instanceof Labeled l) { + // TODO append button label to operand + } + } + + @FXML + void handlePoint() { + var operandString = getOperandString(); + if (operandString.contains(".")) { + // TODO remove characters after point + } else { + // TODO append point + } + } + + @FXML + void handleClear() { + // TODO clear operand + } + + @FXML + void handleSwap() { + // TODO clear operand + } + + private void performOperation(UnaryOperator op) { + // TODO + } + + private void performOperation(boolean swap, BinaryOperator op) { + if (hasOperand()) { + // TODO push operand first + } + // TODO perform operation, but swap first if needed + } + + @FXML + void handleOpAdd() { + // TODO + } + + @FXML + void handleOpSub() { + // TODO + } + + @FXML + void handleOpMult() { + // TODO + } +} diff --git a/modules-template/ui/src/main/resources/ui/App.fxml b/modules-template/ui/src/main/resources/ui/App.fxml new file mode 100644 index 0000000..ff280af --- /dev/null +++ b/modules-template/ui/src/main/resources/ui/App.fxml @@ -0,0 +1,64 @@ + + + + + + + + + + +