Skip to content

Commit

Permalink
Added Checkstyle to Transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
elisab3 committed May 24, 2026
1 parent dd22359 commit e40cc48
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions src/main/java/Model/Transaction.java
Original file line number Diff line number Diff line change
@@ -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);

}

0 comments on commit e40cc48

Please sign in to comment.