01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
05: *
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: */
22:
23: package net.sf.jmoney.reconciliation.reconcilePage;
24:
25: import net.sf.jmoney.reconciliation.BankStatement;
26:
27: /**
28: * Class containing a statement together with the opening
29: * and closing balances on that statement. This object is
30: * useful for encapsulating balances with the BankStatement
31: * objects and is used within this package.
32: * <P>
33: * This class implements Comparable. This enables objects of
34: * this class to be maintained in a sorted map.
35: *
36: * @author Nigel Westbury
37: */
38: class StatementDetails implements Comparable<StatementDetails> {
39: BankStatement statement;
40: long openingBalance;
41: long totalEntriesOnStatement;
42:
43: StatementDetails(BankStatement statement, long openingBalance,
44: long totalEntriesOnStatement) {
45: this .statement = statement;
46: this .openingBalance = openingBalance;
47: this .totalEntriesOnStatement = totalEntriesOnStatement;
48: }
49:
50: long getClosingBalance() {
51: return openingBalance + totalEntriesOnStatement;
52: }
53:
54: public void adjustOpeningBalance(long amount) {
55: openingBalance += amount;
56: }
57:
58: public void adjustEntriesTotal(long amount) {
59: totalEntriesOnStatement += amount;
60: }
61:
62: public int compareTo(StatementDetails other) {
63: return statement.compareTo(other.statement);
64: }
65: }
|