Rename transaction-related references of transfer amount to balance

This is done for more consistency between methods.
This commit is contained in:
Allink 2023-05-20 05:54:24 +01:00
parent cad1ab8ec7
commit cd5c42801d
No known key found for this signature in database
4 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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(" (")

View File

@ -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)
{

View File

@ -8,7 +8,7 @@ public interface Transaction
EconomicEntity getDestination();
long getTransferAmount();
long getBalance();
long addBalance(final long amount);