Commit c618b5f8 by Guilhem Lavaux Committed by Michael Koch

[multiple changes]

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
parent b6b8f690
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> 2003-11-19 Sascha Brawer <brawer@dandelis.ch>
* java/awt/geom/FlatteningPathIterator.java: Entirely re-written. * java/awt/geom/FlatteningPathIterator.java: Entirely re-written.
......
...@@ -37,6 +37,7 @@ exception statement from your version. */ ...@@ -37,6 +37,7 @@ exception statement from your version. */
package java.text; package java.text;
import java.util.Currency;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
...@@ -637,6 +638,19 @@ public class DecimalFormat extends NumberFormat ...@@ -637,6 +638,19 @@ public class DecimalFormat extends NumberFormat
return dest; 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 () public DecimalFormatSymbols getDecimalFormatSymbols ()
{ {
return symbols; return symbols;
...@@ -856,6 +870,16 @@ public class DecimalFormat extends NumberFormat ...@@ -856,6 +870,16 @@ public class DecimalFormat extends NumberFormat
return result; 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) public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
{ {
symbols = newSymbols; symbols = newSymbols;
......
...@@ -39,6 +39,7 @@ exception statement from your version. */ ...@@ -39,6 +39,7 @@ exception statement from your version. */
package java.text; package java.text;
import java.io.Serializable; import java.io.Serializable;
import java.util.Currency;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
...@@ -195,6 +196,18 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable ...@@ -195,6 +196,18 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
} }
/** /**
* 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, * This method returns the currency symbol in local format. For example,
* "$" for Canadian dollars. * "$" for Canadian dollars.
* *
...@@ -354,6 +367,16 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable ...@@ -354,6 +367,16 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
} }
/** /**
* 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. * This method sets the currency symbol to the specified value.
* *
* @param currencySymbol The new currency symbol * @param currencySymbol The new currency symbol
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment