From 1a83e94761b4a5c8f0aff6262ef1540146754708 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 16 Feb 2026 11:54:13 +0100 Subject: [PATCH] Feat: Added transactioncalculator variable on Transaction class --- .../idi/idatt2003/g40/mappe/Transaction.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Transaction.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Transaction.java index 40576ef..4030335 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Transaction.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Transaction.java @@ -10,7 +10,7 @@ public abstract class Transaction { private final int week; - // private final TransactionCalculator; + private final TransactionCalculator calculator; private boolean commited = false; @@ -21,10 +21,11 @@ public abstract class Transaction { * @param week the current week to perform the transaction under */ - protected Transaction(final Share share, final int week - /*,final TransactionCalculator calculator*/) { + protected Transaction(final Share share, final int week, + final TransactionCalculator calculator) { this.share = share; this.week = week; + this.calculator = calculator; } /** @@ -43,9 +44,14 @@ public int getWeek() { return week; } - /*public getCalculator() { - return calculator; - }*/ + /** + * Returns the calculator used by this transaction. + * + * @return calculator + */ + public TransactionCalculator getCalculator() { + return calculator; + } /** * Returns whether this transaction has been commited or not.