|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:10
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8437/src/java/org/neuclear/ledger/simple Modified Files: SimpleLedger.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: SimpleLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple/SimpleLedger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimpleLedger.java 22 Mar 2004 23:20:50 -0000 1.3 --- SimpleLedger.java 25 Mar 2004 16:44:21 -0000 1.4 *************** *** 4,7 **** --- 4,13 ---- * $Id$ * $Log$ + * Revision 1.4 2004/03/25 16:44:21 pelle + * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. + * The hibernate implementation has changed the comment size to 255 to work with mysql and now + * has included hibernates full hibernate.properties to make it easier to try various databases. + * It has now been tested with hsql and mysql. + * * Revision 1.3 2004/03/22 23:20:50 pelle * Working on Hibernate Implementation. *************** *** 140,144 **** while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (getAvailableBalance(item.getBook()) + item.getAmount() < 0) throw new InsufficientFundsException(this, item.getBook(), item.getAmount()); } --- 146,150 ---- while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (item.getAmount() < 0 && getAvailableBalance(item.getBook()) + item.getAmount() < 0) throw new InsufficientFundsException(this, item.getBook(), item.getAmount()); } *************** *** 292,295 **** --- 298,311 ---- } + public double getTestBalance() throws LowlevelLedgerException { + Iterator iter = balances.keySet().iterator(); + double test = 0; + while (iter.hasNext()) { + String s = (String) iter.next(); + test += ((Double) balances.get(s)).doubleValue(); + } + return test; + } + public void close() { //To change body of implemented methods use File | Settings | File Templates. |