From: Damyan Ivanov Date: Tue, 26 Nov 2019 21:58:15 +0000 (+0200) Subject: LedgerTransactionAccount: add copy constructor X-Git-Tag: v0.11.0~15 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=2681ef6acda4128b8af6566a7925eb041083bcbc;p=mobile-ledger.git LedgerTransactionAccount: add copy constructor --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java index 1446be79..801e0169 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java @@ -30,7 +30,7 @@ public class LedgerTransactionAccount { private String accountName; private String shortAccountName; private float amount; - private boolean amountSet; + private boolean amountSet = false; private String currency; public LedgerTransactionAccount(String accountName, float amount) { @@ -46,6 +46,13 @@ public class LedgerTransactionAccount { public LedgerTransactionAccount(String accountName) { this.accountName = accountName; } + public LedgerTransactionAccount(LedgerTransactionAccount origin) { + // copy constructor + setAccountName(origin.getAccountName()); + if (origin.isAmountSet()) + setAmount(origin.getAmount()); + currency = origin.getCurrency(); + } public String getAccountName() { return accountName;