From e40cc48846bcbc628359a139ee74ae9e1c1092bb Mon Sep 17 00:00:00 2001 From: Elisabeth Berg Date: Sun, 24 May 2026 23:57:49 +0200 Subject: [PATCH] Added Checkstyle to Transaction --- src/main/java/Model/Transaction.java | 68 +++++++++++++++------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/src/main/java/Model/Transaction.java b/src/main/java/Model/Transaction.java index de68854..cedd4d2 100644 --- a/src/main/java/Model/Transaction.java +++ b/src/main/java/Model/Transaction.java @@ -1,42 +1,46 @@ package Model; + +/** + * Transaction class. + */ public abstract class Transaction { - private Share share; - private int week; - private TransactionCalculator calculator; - protected boolean committed; - - protected Transaction(Share share, int week, TransactionCalculator calculator) { - if (share == null) { - throw new IllegalArgumentException("Share cannot be null"); - } - if (week < 1) { - throw new IllegalArgumentException("Week must be at least 1"); - } - if (calculator == null) { - throw new IllegalArgumentException("Calculator cannot be null"); - } - - this.share = share; - this.week = week; - this.calculator = calculator; - } + private Share share; + private int week; + private TransactionCalculator calculator; + protected boolean committed; - public Share getShare() { - return this.share; + protected Transaction(Share share, int week, TransactionCalculator calculator) { + if (share == null) { + throw new IllegalArgumentException("Share cannot be null"); } - - public int getWeek() { - return this.week; + if (week < 1) { + throw new IllegalArgumentException("Week must be at least 1"); } - - public TransactionCalculator getCalculator() { - return this.calculator; + if (calculator == null) { + throw new IllegalArgumentException("Calculator cannot be null"); } - public boolean isCommitted() { - return this.committed; - } + this.share = share; + this.week = week; + this.calculator = calculator; + } + + public Share getShare() { + return this.share; + } + + public int getWeek() { + return this.week; + } + + public TransactionCalculator getCalculator() { + return this.calculator; + } + + public boolean isCommitted() { + return this.committed; + } - public abstract void commit(Player player); + public abstract void commit(Player player); }