avatar

602

Another pass at fixing the USD translation, at least when there are other items that actually have the approximate USD equivalence of non-USD currencies.

by mrs, 14 Aug, 2008 09:13 AM
600 602  
171171       switch(j) {
172172         case -1: return aEntry;
173173         case TableColumnController.ID: return aEntry.getIdentifier();
174         case TableColumnController.CUR_BID: return aEntry.getUSCurBid();
174         case TableColumnController.CUR_BID:
175           Currency rval = aEntry.getUSCurBid();
176           if(rval.getValue() == 0.0 && rval.getCurrencyType() == Currency.US_DOLLAR) {
177             return Currency.convertToUSD(null, null, aEntry.getCurBid());
178           }
179           return rval;
175180         case TableColumnController.SNIPE_OR_MAX:
176181           return Currency.convertToUSD(aEntry.getUSCurBid(), aEntry.getCurBid(), getMaxOrSnipe(aEntry));
177182         case TableColumnController.TIME_LEFT: return aEntry.getEndDate();
598 602  
4141   public static Currency convertToUSD(Currency usd, Currency nonusd, Currency cvt) {
4242     if(cvt != null && !cvt.isNull() && cvt.getCurrencyType() != US_DOLLAR) {
4343       double multiple;
44       if((usd == null || usd.isNull() || usd.getValue() == 0.0 ||
45           nonusd == null || nonusd.isNull() || nonusd.getValue() == 0.0) &&
46           sCurrencyMap.containsKey(cvt.getCurrencyType())) {
47         multiple = sCurrencyMap.get(cvt.getCurrencyType());
44       if(usd == null || usd.isNull() || usd.getValue() == 0.0 ||
45           nonusd == null || nonusd.isNull() || nonusd.getValue() == 0.0) {
46         if(sCurrencyMap.containsKey(cvt.getCurrencyType())) {
47           multiple = sCurrencyMap.get(cvt.getCurrencyType());
48         } else {
49           multiple = 0.0;
50         }
4851       } else {
4952         multiple = usd.getValue() / nonusd.getValue();
5053         if(multiple != 0.0) sCurrencyMap.put(nonusd.getCurrencyType(), multiple);