]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/LedgerTransactionItem.java
move DB structure initialization in a sql_0.sql script
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / LedgerTransactionItem.java
1 package net.ktnx.mobileledger;
2
3 class LedgerTransactionItem {
4     private String account_name;
5     private float amount;
6     private boolean amount_set;
7
8     LedgerTransactionItem(String account_name, float amount) {
9         this.account_name = account_name;
10         this.amount = amount;
11         this.amount_set = true;
12     }
13
14     public LedgerTransactionItem(String account_name) {
15         this.account_name = account_name;
16     }
17
18     public String get_account_name() {
19         return account_name;
20     }
21
22     public void set_account_name(String account_name) {
23         this.account_name = account_name;
24     }
25
26     public float get_amount() {
27         if (!amount_set)
28             throw new IllegalStateException("Account amount is not set");
29
30         return amount;
31     }
32
33     public void set_amount(float account_amount) {
34         this.amount = account_amount;
35         this.amount_set = true;
36     }
37
38     public void reset_amount() {
39         this.amount_set = false;
40     }
41
42     public boolean is_amount_set() {
43         return amount_set;
44     }
45 }