From cd5c42801d814902171e98d810da52a6c074b52e Mon Sep 17 00:00:00 2001 From: Allink Date: Sat, 20 May 2023 05:54:24 +0100 Subject: [PATCH] Rename transaction-related references of transfer amount to balance This is done for more consistency between methods. --- .../fossil/economy/SimpleTransaction.java | 14 +++++++------- .../fossil/economy/SimpleTransactionLogger.java | 2 +- .../fossil/economy/SimpleTransactor.java | 2 +- .../java/me/totalfreedom/economy/Transaction.java | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java index b65f8b6..0e1ea2c 100644 --- a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java +++ b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java @@ -9,19 +9,19 @@ public class SimpleTransaction implements Transaction { private final EconomicEntity source; private final EconomicEntity destination; - private final AtomicLong transferAmount; + private final AtomicLong balance; - public SimpleTransaction(EconomicEntity source, EconomicEntity destination, long transferAmount) + public SimpleTransaction(EconomicEntity source, EconomicEntity destination, long balance) { this.source = source; this.destination = destination; - this.transferAmount = new AtomicLong(transferAmount); + this.balance = new AtomicLong(balance); } @Override public Transaction copy() { - return new SimpleTransaction(source, destination, transferAmount.get()); + return new SimpleTransaction(source, destination, balance.get()); } @Override @@ -37,15 +37,15 @@ public class SimpleTransaction implements Transaction } @Override - public long getTransferAmount() + public long getBalance() { - return transferAmount.get(); + return balance.get(); } @Override public long addBalance(long amount) { - return transferAmount.addAndGet(amount); + return balance.addAndGet(amount); } @Override diff --git a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactionLogger.java b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactionLogger.java index 2f6d9cd..6f7614f 100644 --- a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactionLogger.java +++ b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactionLogger.java @@ -21,7 +21,7 @@ public class SimpleTransactionLogger implements TransactionLogger Transaction transaction = completedTransaction.getTransaction(); EconomicEntity source = transaction.getSource(); EconomicEntity destination = transaction.getDestination(); - long transactionAmount = transaction.getTransferAmount(); + long transactionAmount = transaction.getBalance(); transactionLoggingStatementBuilder.append(resultSuccess ? "Successful" : "Unsuccessful") .append(" (") diff --git a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactor.java b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactor.java index b0fedad..913ded3 100644 --- a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactor.java +++ b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransactor.java @@ -16,7 +16,7 @@ public class SimpleTransactor implements Transactor return new SimpleCompletedTransaction(transaction, SimpleTransactionResult.UNAUTHORIZED); } - long transactionAmount = transaction.getTransferAmount(); + long transactionAmount = transaction.getBalance(); if (transactionAmount >= 0) { diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java index d61b3c0..bcafa51 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java @@ -8,7 +8,7 @@ public interface Transaction EconomicEntity getDestination(); - long getTransferAmount(); + long getBalance(); long addBalance(final long amount);