[multiple changes]
authorGuilhem Lavaux <guilhem@kaffe.org>
Wed, 19 Nov 2003 12:06:38 +0000 (12:06 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 19 Nov 2003 12:06:38 +0000 (12:06 +0000)
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.

Co-Authored-By: Jim Pick <jim@kaffe.org>
From-SVN: r73735

libjava/ChangeLog
libjava/java/text/DecimalFormat.java
libjava/java/text/DecimalFormatSymbols.java

index ef79f94e5b6693deb1a8ce1b36531a6d4df09146..98cc75e7279724cebc211e3a6fe36883bce8b88b 100644 (file)
@@ -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 8dae1872fd3c5a7eb1e44dc31ff8fcba6578d841..359ad5591b0513816502c2c05f696e5d0dbd0660 100644 (file)
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.text;
 
+import java.util.Currency;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -637,6 +638,19 @@ public class DecimalFormat extends NumberFormat
     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;
@@ -856,6 +870,16 @@ public class DecimalFormat extends NumberFormat
     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)
   {
     symbols = newSymbols;
index 2c1d971a6492a399a68a8b7057804c582b7e5cf6..1cb8f4f17690c2300449f887a03723f75a9e10c2 100644 (file)
@@ -39,6 +39,7 @@ exception statement from your version. */
 package java.text;
 
 import java.io.Serializable;
+import java.util.Currency;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -194,6 +195,18 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
            && zeroDigit == dfs.zeroDigit);
   }
 
+  /**
+   * 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.
@@ -353,6 +366,16 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
     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());
+  }
+
   /**
    * This method sets the currency symbol to the specified value.
    *