From 1bf21dcc90988033b3d93c91a251f842bf828dbb Mon Sep 17 00:00:00 2001 From: = Date: Fri, 13 Feb 2026 16:42:51 +0100 Subject: [PATCH] Feat: Added transaction class --- .idea/checkstyle-idea.xml | 30 +++++++-- .../idi/idatt2003/g40/mappe/Transaction.java | 62 +++++++++++++++++++ 2 files changed, 87 insertions(+), 5 deletions(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 9950095..cec0567 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,15 +1,35 @@ - 13.0.0 - JavaOnly + 13.1.0 + JavaOnlyWithTests + true true 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 e69de29..40576ef 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 @@ -0,0 +1,62 @@ +package edu.ntnu.idi.idatt2003.g40.mappe; + +/** + * Transaction abstract class. + * + *

Used for transactions

*/ +public abstract class Transaction { + + private final Share share; + + private final int week; + + // private final TransactionCalculator; + + private boolean commited = false; + + /** + * Creates a new {@code Transaction} with a share, week and calculator. + * + * @param share the share to perform the transaction on + * @param week the current week to perform the transaction under + */ + + protected Transaction(final Share share, final int week + /*,final TransactionCalculator calculator*/) { + this.share = share; + this.week = week; + } + + /** + * Returns the share this transaction was made on. + * + * @return share*/ + public Share getShare() { + return share; + } + + /** + * Returns the week this transaction was made during. + * + * @return week*/ + public int getWeek() { + return week; + } + + /*public getCalculator() { + return calculator; + }*/ + + /** + * Returns whether this transaction has been commited or not. + * + * @return commited*/ + public boolean isCommited() { + return commited; + } + + /** Commits the transaction. */ + public void commit() { + commited = true; + } +}