avatar

411

Support Indian Rupees.

by mrs, 05 Apr, 2008 01:46 AM
355 411  
8282                   { new Currency( "CHF4999.99"), new Currency("CHF10.00") },
8383                   { Currency.NoValue(), new Currency("CHF50.00") } };
8484 
85   private static Currency[][] ir_incrementTable = {
86           {new Currency("INR99.99"), new Currency("INR25.00")},
87           {new Currency("INR499.99"), new Currency("INR50.00")},
88           {new Currency("INR999.99"), new Currency("INR75.00")},
89           {new Currency("INR1999.99"), new Currency("INR100.00")},
90           {new Currency("INR3999.99"), new Currency("INR150.00")},
91           {new Currency("INR9999.99"), new Currency("INR200.00")},
92           {new Currency("INR24999.99"), new Currency("INR300.00")},
93           {new Currency("INR49999.99"), new Currency("INR500.00")},
94           {new Currency("INR99999.99"), new Currency("INR750.00")},
95           {Currency.NoValue(), new Currency("INR2000.00")}};
96 
8597   private static Currency zeroDollars = new Currency("$0.00");
8698   private static Currency zeroPounds = new Currency("GBP 0.00");
8799   private static Currency zeroFrancs = new Currency("FR 0.00");
88100   private static Currency zeroSwissFrancs = new Currency("CHF0.00");
89101   private static Currency zeroEuros = new Currency("EUR 0.00");
90102   private static Currency zeroAustralian = new Currency("AUD0.00");
103   private static Currency zeroIndianRupee = new Currency("INR0.00");
91104   private static Currency zeroTaiwanese = new Currency("NTD0.00");
92105   private static Currency zeroCanadian = new Currency("CAD0.00");
93106 
------
134147         rightTable = au_incrementTable;
135148         zeroIncrement = zeroAustralian;
136149         break;
150       case Currency.IND_RUPEE:
151         rightTable = ir_incrementTable;
152         zeroIncrement = zeroIndianRupee;
153         break;
137154     }
138155 
139156     if (bidCount == 0) return zeroIncrement;
355 411  
1212 public class Currency implements Comparable {
1313   private static NumberFormat df = NumberFormat.getNumberInstance(Locale.US); // We create a lot of these, so minimizing memory usage is good.
1414   public static final int NONE=0, US_DOLLAR=1, UK_POUND=2, JP_YEN=3, GER_MARK=4, FR_FRANC=5, CAN_DOLLAR=6;
15   public static final int EURO=7, AU_DOLLAR=8, CH_FRANC=9, NT_DOLLAR=10, TW_DOLLAR=10, HK_DOLLAR=11, MY_REAL=12, SG_DOLLAR=13;
15   public static final int EURO=7, AU_DOLLAR=8, CH_FRANC=9, NT_DOLLAR=10, TW_DOLLAR=10, HK_DOLLAR=11;
16   public static final int MY_REAL=12, SG_DOLLAR=13, IND_RUPEE=14;
1617   private static Currency _noValue = null;
1718 
1819   /** 
------
7273   private static final Integer CurHK = HK_DOLLAR;      //  Hong Kong Dollar
7374   private static final Integer CurMyr = MY_REAL;       //  Malaysia Real(?)
7475   private static final Integer CurSGD = SG_DOLLAR;     //  Singapore Dollar
76   private static final Integer CurRupee = IND_RUPEE;   //  Indian Rupee
7577 
7678   //  The fundamental list of the textual representation for different
7779   //  currencies, and the Currency type it translates to.
------
117119     { "MYR",    CurMyr },
118120     { "myr",    CurMyr },
119121     { "SGD",    CurSGD },
120     { "sgd",    CurSGD }
122     { "sgd",    CurSGD },
123     { "INR",    CurRupee },
124     { "inr",    CurRupee }
121125   };
122126 
123127   /** 
------
271275       } else if(wholeValue.startsWith("sgd")) {
272276         parseCurrency = "SGD";
273277         valuePortion = wholeValue.substring(3);
278       } else if(wholeValue.startsWith("INR")) {
279         parseCurrency = "INR";
280         valuePortion = wholeValue.substring(3);
281       } else if(wholeValue.startsWith("inr")) {
282         parseCurrency = "INR";
283         valuePortion = wholeValue.substring(3);
274284       } else if(wholeValue.startsWith("nt$")) {
275285         parseCurrency = "NTD";
276286         valuePortion = wholeValue.substring(3);
------
365375       case HK_DOLLAR: return("HKD");
366376       case MY_REAL: return("MYR");
367377       case SG_DOLLAR: return("SGD");
378       case IND_RUPEE: return("INR");
368379       case UK_POUND: return("GBP");
369380       case JP_YEN: return("JPY");
370381       case GER_MARK: return("DM");
------
444455       case HK_DOLLAR: return("hk$");
445456       case MY_REAL: return("myr");
446457       case SG_DOLLAR: return("sgd");
458       case IND_RUPEE: return("Rs.");
447459       case UK_POUND: return(objPound.toString());
448460       case JP_YEN: return("\u00A5"); //  HACKHACK
449461       case FR_FRANC: return("fr");