This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.text
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 19 Nov 2003 13:08:21 +0100
- Subject: FYI: Patch: java.text
Hi list,
I commited the attached patch to merge with classpath.
Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2345
diff -u -b -B -r1.2345 ChangeLog
--- ChangeLog 19 Nov 2003 12:02:09 -0000 1.2345
+++ ChangeLog 19 Nov 2003 12:05:08 -0000
@@ -1,3 +1,14 @@
+2003-11-19 Guilhem Lavaux <guilhem@kaffe.org>
+ Jim Pick <jim@kaffe.org>
+
+ * java/text/DecimalFormat.java (getCurrency, setCurrency): New
+ methods.
+
+2003-11-19 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/text/DecimalFormatSymbols.java (getCurrency,
+ setCurrency): New methods.
+
2003-11-19 Sascha Brawer <brawer@dandelis.ch>
* java/awt/geom/FlatteningPathIterator.java: Entirely re-written.
Index: java/text/DecimalFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/DecimalFormat.java,v
retrieving revision 1.13
diff -u -b -B -r1.13 DecimalFormat.java
--- java/text/DecimalFormat.java 29 Oct 2003 16:07:59 -0000 1.13
+++ java/text/DecimalFormat.java 19 Nov 2003 12:05:08 -0000
@@ -37,6 +37,7 @@
package java.text;
+import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -637,6 +638,19 @@
return dest;
}
+ /**
+ * Returns the currency corresponding to the currency symbol stored
+ * in the instance of <code>DecimalFormatSymbols</code> used by this
+ * <code>DecimalFormat</code>.
+ *
+ * @return A new instance of <code>Currency</code> if
+ * the currency code matches a known one, null otherwise.
+ */
+ public Currency getCurrency()
+ {
+ return symbols.getCurrency();
+ }
+
public DecimalFormatSymbols getDecimalFormatSymbols ()
{
return symbols;
@@ -854,6 +868,16 @@
pos.setIndex(index + suffix.length());
return result;
+ }
+
+ /**
+ * Sets the <code>Currency</code> on the
+ * <code>DecimalFormatSymbols</code> used, which also sets the
+ * currency symbols on those symbols.
+ */
+ public void setCurrency(Currency currency)
+ {
+ symbols.setCurrency(currency);
}
public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
Index: java/text/DecimalFormatSymbols.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/DecimalFormatSymbols.java,v
retrieving revision 1.9
diff -u -b -B -r1.9 DecimalFormatSymbols.java
--- java/text/DecimalFormatSymbols.java 22 Jan 2002 22:40:37 -0000 1.9
+++ java/text/DecimalFormatSymbols.java 19 Nov 2003 12:05:08 -0000
@@ -39,6 +39,7 @@
package java.text;
import java.io.Serializable;
+import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -195,6 +196,18 @@
}
/**
+ * Returns the currency corresponding to the currency symbol stored
+ * in the instance of <code>DecimalFormatSymbols</code>.
+ *
+ * @return A new instance of <code>Currency</code> if
+ * the currency code matches a known one.
+ */
+ public Currency getCurrency ()
+ {
+ return Currency.getInstance (currencySymbol);
+ }
+
+ /**
* This method returns the currency symbol in local format. For example,
* "$" for Canadian dollars.
*
@@ -351,6 +364,16 @@
// separator -- JCL book. This probably isn't a very good hash
// code.
return zeroDigit << 16 + groupingSeparator << 8 + decimalSeparator;
+ }
+
+ /**
+ * This method sets the currency to the specified value.
+ *
+ * @param currency The new currency
+ */
+ public void setCurrency (Currency currency)
+ {
+ setCurrencySymbol (currency.getSymbol());
}
/**