|
|
| 355 |
411 |
|
| 12 | 12 | public class Currency implements Comparable {
|
| 13 | 13 | private static NumberFormat df = NumberFormat.getNumberInstance(Locale.US); // We create a lot of these, so minimizing memory usage is good.
|
| 14 | 14 | 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;
|
| 16 | 17 | private static Currency _noValue = null;
|
| 17 | 18 |
|
| 18 | 19 | /**
|
| --- | --- | |
| 72 | 73 | private static final Integer CurHK = HK_DOLLAR; // Hong Kong Dollar
|
| 73 | 74 | private static final Integer CurMyr = MY_REAL; // Malaysia Real(?)
|
| 74 | 75 | private static final Integer CurSGD = SG_DOLLAR; // Singapore Dollar
|
| 76 | private static final Integer CurRupee = IND_RUPEE; // Indian Rupee
|
| 75 | 77 |
|
| 76 | 78 | // The fundamental list of the textual representation for different
|
| 77 | 79 | // currencies, and the Currency type it translates to.
|
| --- | --- | |
| 117 | 119 | { "MYR", CurMyr },
|
| 118 | 120 | { "myr", CurMyr },
|
| 119 | 121 | { "SGD", CurSGD },
|
| 120 | | { "sgd", CurSGD }
|
| 122 | { "sgd", CurSGD },
|
| 123 | { "INR", CurRupee },
|
| 124 | { "inr", CurRupee }
|
| 121 | 125 | };
|
| 122 | 126 |
|
| 123 | 127 | /**
|
| --- | --- | |
| 271 | 275 | } else if(wholeValue.startsWith("sgd")) {
|
| 272 | 276 | parseCurrency = "SGD";
|
| 273 | 277 | 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);
|
| 274 | 284 | } else if(wholeValue.startsWith("nt$")) {
|
| 275 | 285 | parseCurrency = "NTD";
|
| 276 | 286 | valuePortion = wholeValue.substring(3);
|
| --- | --- | |
| 365 | 375 | case HK_DOLLAR: return("HKD");
|
| 366 | 376 | case MY_REAL: return("MYR");
|
| 367 | 377 | case SG_DOLLAR: return("SGD");
|
| 378 | case IND_RUPEE: return("INR");
|
| 368 | 379 | case UK_POUND: return("GBP");
|
| 369 | 380 | case JP_YEN: return("JPY");
|
| 370 | 381 | case GER_MARK: return("DM");
|
| --- | --- | |
| 444 | 455 | case HK_DOLLAR: return("hk$");
|
| 445 | 456 | case MY_REAL: return("myr");
|
| 446 | 457 | case SG_DOLLAR: return("sgd");
|
| 458 | case IND_RUPEE: return("Rs.");
|
| 447 | 459 | case UK_POUND: return(objPound.toString());
|
| 448 | 460 | case JP_YEN: return("\u00A5"); // HACKHACK
|
| 449 | 461 | case FR_FRANC: return("fr");
|