Skip to content

Feat: Added transaction class #41

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}