From 32bdfe20d98f1c8e6c0aabe9b26f0507326d2baa Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 19 Mar 2006 21:11:49 +0000 Subject: Tons of corrections and fixes to value expressions and lot figures. --- balance.h | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'balance.h') diff --git a/balance.h b/balance.h index c115ba45..d18ffd60 100644 --- a/balance.h +++ b/balance.h @@ -216,7 +216,15 @@ class balance_t return true; } bool operator<(const amount_t& amt) const { - return amount(amt.commodity()) < amt; + if (amt.commodity()) + return amount(amt.commodity()) < amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second < amt) + return true; + return false; } template bool operator<(T val) const { @@ -244,7 +252,15 @@ class balance_t return true; } bool operator<=(const amount_t& amt) const { - return amount(amt.commodity()) <= amt; + if (amt.commodity()) + return amount(amt.commodity()) <= amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second <= amt) + return true; + return false; } template bool operator<=(T val) const { @@ -275,7 +291,15 @@ class balance_t return true; } bool operator>(const amount_t& amt) const { - return amount(amt.commodity()) > amt; + if (amt.commodity()) + return amount(amt.commodity()) > amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second > amt) + return true; + return false; } template bool operator>(T val) const { @@ -303,7 +327,15 @@ class balance_t return true; } bool operator>=(const amount_t& amt) const { - return amount(amt.commodity()) >= amt; + if (amt.commodity()) + return amount(amt.commodity()) >= amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second >= amt) + return true; + return false; } template bool operator>=(T val) const { @@ -327,7 +359,15 @@ class balance_t return i == amounts.end() && j == bal.amounts.end(); } bool operator==(const amount_t& amt) const { - return amounts.size() == 1 && (*amounts.begin()).second == amt; + if (amt.commodity()) + return amounts.size() == 1 && (*amounts.begin()).second == amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second == amt) + return true; + return false; } template bool operator==(T val) const { -- cgit v1.2.3