Skip to content

Commit

Permalink
Feat: Added transaction class
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyah committed Feb 13, 2026
1 parent 4a28ffa commit 1bf21dc
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 5 deletions.
30 changes: 25 additions & 5 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Transaction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package edu.ntnu.idi.idatt2003.g40.mappe;

/**
* Transaction abstract class.
*
* <p>Used for transactions</p> */
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;
}
}

0 comments on commit 1bf21dc

Please sign in to comment.