com.ibm.icu.text
Class DecimalFormatSymbols

java.lang.Object
  extended by com.ibm.icu.text.DecimalFormatSymbols
All Implemented Interfaces:
Serializable, Cloneable

public final class DecimalFormatSymbols
extends Object
implements Cloneable, Serializable

This class represents the set of symbols (such as the decimal separator, the grouping separator, and so on) needed by DecimalFormat to format numbers. DecimalFormat creates for itself an instance of DecimalFormatSymbols from its locale data. If you need to change any of these symbols, you can get the DecimalFormatSymbols object from your DecimalFormat and modify it.

This is an enhanced version of DecimalFormatSymbols that is based on the standard version in the JDK. New or changed functionality is labeled NEW.

Author:
Mark Davis, Alan Liu
See Also:
Locale, DecimalFormat, Serialized Form

Constructor Summary
DecimalFormatSymbols()
          Create a DecimalFormatSymbols object for the default locale.
DecimalFormatSymbols(Locale locale)
          Create a DecimalFormatSymbols object for the given locale.
DecimalFormatSymbols(ULocale locale)
          Create a DecimalFormatSymbols object for the given locale.
 
Method Summary
 Object clone()
          Standard override.
 boolean equals(Object obj)
          Override equals.
 Currency getCurrency()
          Returns the currency symbol, for JDK 1.4 compatibility only.
 String getCurrencySymbol()
          Return the string denoting the local currency.
 char getDecimalSeparator()
          Return the character used for decimal sign.
 char getDigit()
          Return the character used for a digit in a pattern.
 String getExponentSeparator()
          NEW Return the string used to separate the mantissa from the exponent.
 char getGroupingSeparator()
          Return the character used for thousands separator.
 String getInfinity()
          Return the String used to represent infinity.
 String getInternationalCurrencySymbol()
          Return the international string denoting the local currency.
 Locale getLocale()
          Returns the locale for which this object was constructed.
 ULocale getLocale(ULocale.Type type)
          Return the locale that was used to create this object, or null.
 char getMinusSign()
          Return the character used to represent minus sign.
 char getMonetaryDecimalSeparator()
          Return the monetary decimal separator.
 String getNaN()
          Return the String used to represent NaN.
 char getPadEscape()
          NEW Return the character used to pad numbers out to a specified width.
 char getPatternSeparator()
          Return the character used to separate positive and negative subpatterns in a pattern.
 char getPercent()
          Return the character used for percent sign.
 char getPerMill()
          Return the character used for mille percent sign.
 char getPlusSign()
          NEW Return the localized plus sign.
 char getSignificantDigit()
          Return the character used to represent a significant digit in a pattern.
 ULocale getULocale()
          Returns the locale for which this object was constructed.
 char getZeroDigit()
          Return the character used for zero.
 int hashCode()
          Override hashCode
 void setCurrency(Currency currency)
          ICU does not use the DecimalFormatSymbols for the currency any more.
 void setCurrencySymbol(String currency)
          Set the string denoting the local currency.
 void setDecimalSeparator(char decimalSeparator)
          Set the character used for decimal sign.
 void setDigit(char digit)
          Set the character used for a digit in a pattern.
 void setExponentSeparator(String exp)
          NEW Set the string used to separate the mantissa from the exponent.
 void setGroupingSeparator(char groupingSeparator)
          Set the character used for thousands separator.
 void setInfinity(String infinity)
          Set the String used to represent infinity.
 void setInternationalCurrencySymbol(String currency)
          Set the international string denoting the local currency.
 void setMinusSign(char minusSign)
          Set the character used to represent minus sign.
 void setMonetaryDecimalSeparator(char sep)
          Set the monetary decimal separator.
 void setNaN(String NaN)
          Set the String used to represent NaN.
 void setPadEscape(char c)
          NEW Set the character used to pad numbers out to a specified width.
 void setPatternSeparator(char patternSeparator)
          Set the character used to separate positive and negative subpatterns in a pattern.
 void setPercent(char percent)
          Set the character used for percent sign.
 void setPerMill(char perMill)
          Set the character used for mille percent sign.
 void setPlusSign(char plus)
          NEW Set the localized plus sign.
 void setSignificantDigit(char sigDigit)
          Set the character used to represent a significant digit in a pattern.
 void setZeroDigit(char zeroDigit)
          Set the character used for zero.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecimalFormatSymbols

public DecimalFormatSymbols()
Create a DecimalFormatSymbols object for the default locale.


DecimalFormatSymbols

public DecimalFormatSymbols(Locale locale)
Create a DecimalFormatSymbols object for the given locale.

Parameters:
locale - the locale

DecimalFormatSymbols

public DecimalFormatSymbols(ULocale locale)
Create a DecimalFormatSymbols object for the given locale.

Parameters:
locale - the locale
Method Detail

getZeroDigit

public char getZeroDigit()
Return the character used for zero. Different for Arabic, etc.

Returns:
the character

setZeroDigit

public void setZeroDigit(char zeroDigit)
Set the character used for zero.

Parameters:
zeroDigit - the zero character.

getSignificantDigit

public char getSignificantDigit()
Return the character used to represent a significant digit in a pattern.

Returns:
the significant digit pattern character

setSignificantDigit

public void setSignificantDigit(char sigDigit)
Set the character used to represent a significant digit in a pattern.

Parameters:
sigDigit - the significant digit pattern character

getGroupingSeparator

public char getGroupingSeparator()
Return the character used for thousands separator. Different for French, etc.

Returns:
the thousands character

setGroupingSeparator

public void setGroupingSeparator(char groupingSeparator)
Set the character used for thousands separator. Different for French, etc.

Parameters:
groupingSeparator - the thousands character

getDecimalSeparator

public char getDecimalSeparator()
Return the character used for decimal sign. Different for French, etc.

Returns:
the decimal character

setDecimalSeparator

public void setDecimalSeparator(char decimalSeparator)
Set the character used for decimal sign. Different for French, etc.

Parameters:
decimalSeparator - the decimal character

getPerMill

public char getPerMill()
Return the character used for mille percent sign. Different for Arabic, etc.

Returns:
the mille percent character

setPerMill

public void setPerMill(char perMill)
Set the character used for mille percent sign. Different for Arabic, etc.

Parameters:
perMill - the mille percent character

getPercent

public char getPercent()
Return the character used for percent sign. Different for Arabic, etc.

Returns:
the percent character

setPercent

public void setPercent(char percent)
Set the character used for percent sign. Different for Arabic, etc.

Parameters:
percent - the percent character

getDigit

public char getDigit()
Return the character used for a digit in a pattern.

Returns:
the digit pattern character

setDigit

public void setDigit(char digit)
Set the character used for a digit in a pattern.

Parameters:
digit - the digit pattern character

getPatternSeparator

public char getPatternSeparator()
Return the character used to separate positive and negative subpatterns in a pattern.

Returns:
the pattern separator character

setPatternSeparator

public void setPatternSeparator(char patternSeparator)
Set the character used to separate positive and negative subpatterns in a pattern.

Parameters:
patternSeparator - the pattern separator character

getInfinity

public String getInfinity()
Return the String used to represent infinity. Almost always left unchanged.

Returns:
the Infinity string

setInfinity

public void setInfinity(String infinity)
Set the String used to represent infinity. Almost always left unchanged.

Parameters:
infinity - the Infinity String

getNaN

public String getNaN()
Return the String used to represent NaN. Almost always left unchanged.

Returns:
the NaN String

setNaN

public void setNaN(String NaN)
Set the String used to represent NaN. Almost always left unchanged.

Parameters:
NaN - the NaN String

getMinusSign

public char getMinusSign()
Return the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.

Returns:
the minus sign character

setMinusSign

public void setMinusSign(char minusSign)
Set the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.

Parameters:
minusSign - the minus sign character

getCurrencySymbol

public String getCurrencySymbol()
Return the string denoting the local currency.

Returns:
the local currency String.

setCurrencySymbol

public void setCurrencySymbol(String currency)
Set the string denoting the local currency.

Parameters:
currency - the local currency String.

getInternationalCurrencySymbol

public String getInternationalCurrencySymbol()
Return the international string denoting the local currency.

Returns:
the international string denoting the local currency

setInternationalCurrencySymbol

public void setInternationalCurrencySymbol(String currency)
Set the international string denoting the local currency.

Parameters:
currency - the international string denoting the local currency.

getCurrency

public Currency getCurrency()
Returns the currency symbol, for JDK 1.4 compatibility only. ICU clients should use the Currency API directly.

Returns:
the currency used, or null

setCurrency

public void setCurrency(Currency currency)
ICU does not use the DecimalFormatSymbols for the currency any more. This API is present for API compatibility only. This also sets the currency symbol attribute to the currency's symbol in the DecimalFormatSymbols' locale, and the international currency symbol attribute to the currency's ISO 4217 currency code.

Parameters:
currency - the new currency to be used
Throws:
NullPointerException - if currency is null
See Also:
setCurrencySymbol(java.lang.String), setInternationalCurrencySymbol(java.lang.String)

getMonetaryDecimalSeparator

public char getMonetaryDecimalSeparator()
Return the monetary decimal separator.

Returns:
the monetary decimal separator character

setMonetaryDecimalSeparator

public void setMonetaryDecimalSeparator(char sep)
Set the monetary decimal separator.

Parameters:
sep - the monetary decimal separator character

getExponentSeparator

public String getExponentSeparator()
NEW Return the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.

Returns:
the localized exponent symbol, used in localized patterns and formatted strings
See Also:
setExponentSeparator(java.lang.String)

setExponentSeparator

public void setExponentSeparator(String exp)
NEW Set the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.

Parameters:
exp - the localized exponent symbol, used in localized patterns and formatted strings
See Also:
getExponentSeparator()

getPlusSign

public char getPlusSign()
NEW Return the localized plus sign.

Returns:
the plus sign, used in localized patterns and formatted strings
See Also:
setPlusSign(char), setMinusSign(char), getMinusSign()

setPlusSign

public void setPlusSign(char plus)
NEW Set the localized plus sign.

Parameters:
plus - the plus sign, used in localized patterns and formatted strings
See Also:
getPlusSign(), setMinusSign(char), getMinusSign()

getPadEscape

public char getPadEscape()
NEW Return the character used to pad numbers out to a specified width. This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character.

Returns:
the character
See Also:
setPadEscape(char), DecimalFormat.getFormatWidth(), DecimalFormat.getPadPosition(), DecimalFormat.getPadCharacter()

setPadEscape

public void setPadEscape(char c)
NEW Set the character used to pad numbers out to a specified width. This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character.

See Also:
getPadEscape(), DecimalFormat.setFormatWidth(int), DecimalFormat.setPadPosition(int), DecimalFormat.setPadCharacter(char)

getLocale

public Locale getLocale()
Returns the locale for which this object was constructed.

Returns:
the locale for which this object was constructed

getULocale

public ULocale getULocale()
Returns the locale for which this object was constructed.

Returns:
the locale for which this object was constructed

clone

public Object clone()
Standard override.

Overrides:
clone in class Object

equals

public boolean equals(Object obj)
Override equals.

Overrides:
equals in class Object

hashCode

public int hashCode()
Override hashCode

Overrides:
hashCode in class Object

getLocale

public final ULocale getLocale(ULocale.Type type)
Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation. For example, if an object is created for locale en_US_CALIFORNIA, the actual data may be drawn from en (the actual locale), and en_US may be the most specific locale that exists (the valid locale).

Note: This method will be implemented in ICU 3.0; ICU 2.8 contains a partial preview implementation. The * actual locale is returned correctly, but the valid locale is not, in most cases.

Parameters:
type - type of information requested, either ULocale.VALID_LOCALE or ULocale.ACTUAL_LOCALE.
Returns:
the information specified by type, or null if this object was not constructed from locale data.
See Also:
ULocale, ULocale.VALID_LOCALE, ULocale.ACTUAL_LOCALE


Copyright (c) 2006 IBM Corporation and others.