Home | History | Annotate | Download | only in text
      1 //  2016 and later: Unicode, Inc. and others.
      2 // License & terms of use: http://www.unicode.org/copyright.html#License
      3 /*
      4  *******************************************************************************
      5  * Copyright (C) 1996-2012, International Business Machines Corporation and    *
      6  * others. All Rights Reserved.                                                *
      7  *******************************************************************************
      8  */
      9 
     10 package com.ibm.icu.text;
     11 
     12 
     13 import java.io.Serializable;
     14 import java.util.Locale;
     15 
     16 import com.ibm.icu.util.Currency;
     17 import com.ibm.icu.util.ULocale;
     18 import com.ibm.icu.util.ULocale.Category;
     19 
     20 /**
     21  * This class represents the set of symbols (such as the decimal separator, the
     22  * grouping separator, and so on) needed by <code>DecimalFormat</code> to format
     23  * numbers. <code>DecimalFormat</code> creates for itself an instance of
     24  * <code>DecimalFormatSymbols</code> from its locale data.  If you need to
     25  * change any of these symbols, you can get the
     26  * <code>DecimalFormatSymbols</code> object from your <code>DecimalFormat</code>
     27  * and modify it.
     28  *
     29  * <p><strong>This is an enhanced version of <code>DecimalFormatSymbols</code> that
     30  * is based on the standard version in the JDK.  New or changed functionality
     31  * is labeled
     32  * <strong><font face=helvetica color=red>NEW</font></strong>.</strong>
     33  *
     34  * @see          java.util.Locale
     35  * @see          DecimalFormat
     36  * @author       Mark Davis
     37  * @author       Alan Liu
     38  * @stable ICU 2.0
     39  */
     40 final public class DecimalFormatSymbols implements Cloneable, Serializable {
     41 
     42     private static final long serialVersionUID =1L;
     43 
     44     /**
     45      * @internal
     46      */
     47     public final java.text.DecimalFormatSymbols dfs;
     48 
     49     /**
     50      * @internal
     51      */
     52     public DecimalFormatSymbols(java.text.DecimalFormatSymbols delegate) {
     53         this.dfs = delegate;
     54     }
     55 
     56     /**
     57      * Create a DecimalFormatSymbols object for the default locale.
     58      * @stable ICU 2.0
     59      */
     60     public DecimalFormatSymbols() {
     61         this(new java.text.DecimalFormatSymbols(ULocale.getDefault(Category.FORMAT).toLocale()));
     62     }
     63 
     64     /**
     65      * Create a DecimalFormatSymbols object for the given locale.
     66      * @param locale the locale
     67      * @stable ICU 2.0
     68      */
     69     public DecimalFormatSymbols(Locale locale) {
     70         this(new java.text.DecimalFormatSymbols(locale));
     71     }
     72 
     73     /**
     74      * Create a DecimalFormatSymbols object for the given locale.
     75      * @param locale the locale
     76      * @stable ICU 3.2
     77      */
     78     public DecimalFormatSymbols(ULocale locale) {
     79         this(new java.text.DecimalFormatSymbols(locale.toLocale()));
     80     }
     81 
     82     /**
     83      * Returns a DecimalFormatSymbols instance for the default locale.
     84      *
     85      * <p><strong>Note:</strong> Unlike
     86      * <code>java.text.DecimalFormatSymbols#getInstance</code>, this method simply returns
     87      * <code>new com.ibm.icu.text.DecimalFormatSymbols()</code>.  ICU currently does not
     88      * support <code>DecimalFormatSymbolsProvider</code>, which was introduced in Java 6.
     89      *
     90      * @return A DecimalFormatSymbols instance.
     91      * @stable ICU 3.8
     92      */
     93     public static DecimalFormatSymbols getInstance() {
     94         return new DecimalFormatSymbols();
     95     }
     96 
     97     /**
     98      * Returns a DecimalFormatSymbols instance for the given locale.
     99      *
    100      * <p><strong>Note:</strong> Unlike
    101      * <code>java.text.DecimalFormatSymbols#getInstance</code>, this method simply returns
    102      * <code>new com.ibm.icu.text.DecimalFormatSymbols(locale)</code>.  ICU currently does
    103      * not support <code>DecimalFormatSymbolsProvider</code>, which was introduced in Java
    104      * 6.
    105      *
    106      * @param locale the locale.
    107      * @return A DecimalFormatSymbols instance.
    108      * @stable ICU 3.8
    109      */
    110     public static DecimalFormatSymbols getInstance(Locale locale) {
    111         return new DecimalFormatSymbols(locale);
    112     }
    113 
    114     /**
    115      * Returns a DecimalFormatSymbols instance for the given locale.
    116      *
    117      * <p><strong>Note:</strong> Unlike
    118      * <code>java.text.DecimalFormatSymbols#getInstance</code>, this method simply returns
    119      * <code>new com.ibm.icu.text.DecimalFormatSymbols(locale)</code>.  ICU currently does
    120      * not support <code>DecimalFormatSymbolsProvider</code>, which was introduced in Java
    121      * 6.
    122      *
    123      * @param locale the locale.
    124      * @return A DecimalFormatSymbols instance.
    125      * @stable ICU 3.8
    126      */
    127     public static DecimalFormatSymbols getInstance(ULocale locale) {
    128         return new DecimalFormatSymbols(locale);
    129     }
    130 
    131 //    /**
    132 //     * Returns an array of all locales for which the <code>getInstance</code> methods of
    133 //     * this class can return localized instances.
    134 //     *
    135 //     * <p><strong>Note:</strong> Unlike
    136 //     * <code>java.text.DecimalFormatSymbols#getAvailableLocales</code>, this method simply
    137 //     * returns the array of <code>Locale</code>s available for this class.  ICU currently
    138 //     * does not support <code>DecimalFormatSymbolsProvider</code>, which was introduced in
    139 //     * Java 6.
    140 //     *
    141 //     * @return An array of <code>Locale</code>s for which localized
    142 //     * <code>DecimalFormatSymbols</code> instances are available.
    143 //     * @stable ICU 3.8
    144 //     */
    145 //    public static Locale[] getAvailableLocales() {
    146 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    147 //    }
    148 
    149 //    /**
    150 //     * {@icu} Returns an array of all locales for which the <code>getInstance</code>
    151 //     * methods of this class can return localized instances.
    152 //     *
    153 //     * <p><strong>Note:</strong> Unlike
    154 //     * <code>java.text.DecimalFormatSymbols#getAvailableLocales</code>, this method simply
    155 //     * returns the array of <code>ULocale</code>s available in this class.  ICU currently
    156 //     * does not support <code>DecimalFormatSymbolsProvider</code>, which was introduced in
    157 //     * Java 6.
    158 //     *
    159 //     * @return An array of <code>ULocale</code>s for which localized
    160 //     * <code>DecimalFormatSymbols</code> instances are available.
    161 //     * @stable ICU 3.8 (retain)
    162 //     * @provisional This API might change or be removed in a future release.
    163 //     */
    164 //    public static ULocale[] getAvailableULocales() {
    165 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    166 //    }
    167 
    168     /**
    169      * Return the character used for zero. Different for Arabic, etc.
    170      * @return the character
    171      * @stable ICU 2.0
    172      */
    173     public char getZeroDigit() {
    174         return dfs.getZeroDigit();
    175     }
    176 
    177     /**
    178      * Set the character used for zero.
    179      * @param zeroDigit the zero character.
    180      * @stable ICU 2.0
    181      */
    182     public void setZeroDigit(char zeroDigit) {
    183         dfs.setZeroDigit(zeroDigit);
    184     }
    185 
    186 //    /**
    187 //     * Returns the character used to represent a significant digit in a pattern.
    188 //     * @return the significant digit pattern character
    189 //     * @stable ICU 3.0
    190 //     */
    191 //    public char getSignificantDigit() {
    192 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    193 //    }
    194 
    195 //    /**
    196 //     * Sets the character used to represent a significant digit in a pattern.
    197 //     * @param sigDigit the significant digit pattern character
    198 //     * @stable ICU 3.0
    199 //     */
    200 //    public void setSignificantDigit(char sigDigit) {
    201 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    202 //    }
    203 
    204     /**
    205      * Return the character used for thousands separator. Different for French, etc.
    206      * @return the thousands character
    207      * @stable ICU 2.0
    208      */
    209     public char getGroupingSeparator() {
    210         return dfs.getGroupingSeparator();
    211     }
    212 
    213     /**
    214      * Set the character used for thousands separator. Different for French, etc.
    215      * @param groupingSeparator the thousands character
    216      * @stable ICU 2.0
    217      */
    218     public void setGroupingSeparator(char groupingSeparator) {
    219         dfs.setGroupingSeparator(groupingSeparator);
    220     }
    221 
    222     /**
    223      * Return the character used for decimal sign. Different for French, etc.
    224      * @return the decimal character
    225      * @stable ICU 2.0
    226      */
    227     public char getDecimalSeparator() {
    228         return dfs.getDecimalSeparator();
    229     }
    230 
    231     /**
    232      * Set the character used for decimal sign. Different for French, etc.
    233      * @param decimalSeparator the decimal character
    234      * @stable ICU 2.0
    235      */
    236     public void setDecimalSeparator(char decimalSeparator) {
    237         dfs.setDecimalSeparator(decimalSeparator);
    238     }
    239 
    240     /**
    241      * Return the character used for mille percent sign. Different for Arabic, etc.
    242      * @return the mille percent character
    243      * @stable ICU 2.0
    244      */
    245     public char getPerMill() {
    246         return dfs.getPerMill();
    247     }
    248 
    249     /**
    250      * Set the character used for mille percent sign. Different for Arabic, etc.
    251      * @param perMill the mille percent character
    252      * @stable ICU 2.0
    253      */
    254     public void setPerMill(char perMill) {
    255         dfs.setPerMill(perMill);
    256     }
    257 
    258     /**
    259      * Return the character used for percent sign. Different for Arabic, etc.
    260      * @return the percent character
    261      * @stable ICU 2.0
    262      */
    263     public char getPercent() {
    264         return dfs.getPercent();
    265     }
    266 
    267     /**
    268      * Set the character used for percent sign. Different for Arabic, etc.
    269      * @param percent the percent character
    270      * @stable ICU 2.0
    271      */
    272     public void setPercent(char percent) {
    273         dfs.setPercent(percent);
    274     }
    275 
    276     /**
    277      * Return the character used for a digit in a pattern.
    278      * @return the digit pattern character
    279      * @stable ICU 2.0
    280      */
    281     public char getDigit() {
    282         return dfs.getDigit();
    283     }
    284 
    285     /**
    286      * Returns the array of characters used as digits, in order from 0 through 9
    287      * @return The array
    288      * @draft ICU 4.6
    289      * @provisional This API might change or be removed in a future release.
    290      */
    291     public char[] getDigits() {
    292         char [] digitArray = new char[10];
    293         for ( int i = 0 ; i < 10 ; i++ ) {
    294             digitArray[i] = (char) (getZeroDigit() + i);
    295         }
    296         return digitArray;
    297     }
    298 
    299     /**
    300      * Set the character used for a digit in a pattern.
    301      * @param digit the digit pattern character
    302      * @stable ICU 2.0
    303      */
    304     public void setDigit(char digit) {
    305         dfs.setDigit(digit);
    306     }
    307 
    308     /**
    309      * Return the character used to separate positive and negative subpatterns
    310      * in a pattern.
    311      * @return the pattern separator character
    312      * @stable ICU 2.0
    313      */
    314     public char getPatternSeparator() {
    315         return dfs.getPatternSeparator();
    316     }
    317 
    318     /**
    319      * Set the character used to separate positive and negative subpatterns
    320      * in a pattern.
    321      * @param patternSeparator the pattern separator character
    322      * @stable ICU 2.0
    323      */
    324     public void setPatternSeparator(char patternSeparator) {
    325         dfs.setPatternSeparator(patternSeparator);
    326     }
    327 
    328     /**
    329      * Return the String used to represent infinity. Almost always left
    330      * unchanged.
    331      * @return the Infinity string
    332      * @stable ICU 2.0
    333      */
    334     public String getInfinity() {
    335         return dfs.getInfinity();
    336     }
    337 
    338     /**
    339      * Set the String used to represent infinity. Almost always left
    340      * unchanged.
    341      * @param infinity the Infinity String
    342      * @stable ICU 2.0
    343      */
    344     public void setInfinity(String infinity) {
    345         dfs.setInfinity(infinity);
    346     }
    347 
    348     /**
    349      * Return the String used to represent NaN. Almost always left
    350      * unchanged.
    351      * @return the NaN String
    352      * @stable ICU 2.0
    353      */
    354     public String getNaN() {
    355         return dfs.getNaN();
    356     }
    357 
    358     /**
    359      * Set the String used to represent NaN. Almost always left
    360      * unchanged.
    361      * @param NaN the NaN String
    362      * @stable ICU 2.0
    363      */
    364     public void setNaN(String NaN) {
    365         dfs.setNaN(NaN);
    366     }
    367 
    368     /**
    369      * Return the character used to represent minus sign. If no explicit
    370      * negative format is specified, one is formed by prefixing
    371      * minusSign to the positive format.
    372      * @return the minus sign character
    373      * @stable ICU 2.0
    374      */
    375     public char getMinusSign() {
    376         return dfs.getMinusSign();
    377     }
    378 
    379     /**
    380      * Set the character used to represent minus sign. If no explicit
    381      * negative format is specified, one is formed by prefixing
    382      * minusSign to the positive format.
    383      * @param minusSign the minus sign character
    384      * @stable ICU 2.0
    385      */
    386     public void setMinusSign(char minusSign) {
    387         dfs.setMinusSign(minusSign);
    388     }
    389 
    390     /**
    391      * Return the string denoting the local currency.
    392      * @return the local currency String.
    393      * @stable ICU 2.0
    394      */
    395     public String getCurrencySymbol() {
    396         return dfs.getCurrencySymbol();
    397     }
    398 
    399     /**
    400      * Set the string denoting the local currency.
    401      * @param currency the local currency String.
    402      * @stable ICU 2.0
    403      */
    404     public void setCurrencySymbol(String currency) {
    405         dfs.setCurrencySymbol(currency);
    406     }
    407 
    408     /**
    409      * Returns the currency symbol, for JDK 1.4 compatibility only.
    410      * ICU clients should use the Currency API directly.
    411      * @return the currency used, or null
    412      * @stable ICU 3.4
    413      */
    414     public Currency getCurrency() {
    415         return new Currency(dfs.getCurrency());
    416     }
    417 
    418     /**
    419      * Sets the currency.
    420      *
    421      * <p><strong>Note:</strong> ICU does not use the DecimalFormatSymbols for the currency
    422      * any more.  This API is present for API compatibility only.
    423      *
    424      * <p>This also sets the currency symbol attribute to the currency's symbol
    425      * in the DecimalFormatSymbols' locale, and the international currency
    426      * symbol attribute to the currency's ISO 4217 currency code.
    427      *
    428      * @param currency the new currency to be used
    429      * @throws NullPointerException if <code>currency</code> is null
    430      * @see #setCurrencySymbol
    431      * @see #setInternationalCurrencySymbol
    432      *
    433      * @stable ICU 3.4
    434      */
    435     public void setCurrency(Currency currency) {
    436         dfs.setCurrency(java.util.Currency.getInstance(currency.getCurrencyCode()));
    437     }
    438 
    439     /**
    440      * Return the international string denoting the local currency.
    441      * @return the international string denoting the local currency
    442      * @stable ICU 2.0
    443      */
    444     public String getInternationalCurrencySymbol() {
    445         return dfs.getInternationalCurrencySymbol();
    446     }
    447 
    448     /**
    449      * Set the international string denoting the local currency.
    450      * @param currency the international string denoting the local currency.
    451      * @stable ICU 2.0
    452      */
    453     public void setInternationalCurrencySymbol(String currency) {
    454         dfs.setInternationalCurrencySymbol(currency);
    455     }
    456 
    457     /**
    458      * Return the monetary decimal separator.
    459      * @return the monetary decimal separator character
    460      * @stable ICU 2.0
    461      */
    462     public char getMonetaryDecimalSeparator() {
    463         return dfs.getMonetaryDecimalSeparator();
    464     }
    465 
    466     /**
    467      * Set the monetary decimal separator.
    468      * @param sep the monetary decimal separator character
    469      * @stable ICU 2.0
    470      */
    471     public void setMonetaryDecimalSeparator(char sep) {
    472         dfs.setMonetaryDecimalSeparator(sep);
    473     }
    474 
    475 //    /**
    476 //     * {@icu} Returns the monetary grouping separator.
    477 //     * @return the monetary grouping separator character
    478 //     * @stable ICU 3.6
    479 //     */
    480 //    public char getMonetaryGroupingSeparator() {
    481 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    482 //    }
    483 
    484 //    /**
    485 //     * Sets the monetary decimal separator.
    486 //     * @param sep the monetary decimal separator character
    487 //     * @stable ICU 3.6
    488 //     */
    489 //    public void setMonetaryGroupingSeparator(char sep) {
    490 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    491 //    }
    492 
    493 //    /**
    494 //     * {@icu} Returns the string used to separate the mantissa from the exponent.
    495 //     * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
    496 //     * @return the localized exponent symbol, used in localized patterns
    497 //     * and formatted strings
    498 //     * @see #setExponentSeparator
    499 //     * @stable ICU 2.0
    500 //     */
    501 //    public String getExponentSeparator() {
    502 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    503 //    }
    504 
    505 //    /**
    506 //     * {@icu} Sets the string used to separate the mantissa from the exponent.
    507 //     * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
    508 //     * @param exp the localized exponent symbol, used in localized patterns
    509 //     * and formatted strings
    510 //     * @see #getExponentSeparator
    511 //     * @stable ICU 2.0
    512 //     */
    513 //    public void setExponentSeparator(String exp) {
    514 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    515 //    }
    516 
    517 //    /**
    518 //     * {@icu} Returns the localized plus sign.
    519 //     * @return the plus sign, used in localized patterns and formatted
    520 //     * strings
    521 //     * @see #setPlusSign
    522 //     * @see #setMinusSign
    523 //     * @see #getMinusSign
    524 //     * @stable ICU 2.0
    525 //     */
    526 //    public char getPlusSign() {
    527 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    528 //    }
    529 
    530 //    /**
    531 //     * {@icu} Sets the localized plus sign.
    532 //     * @param plus the plus sign, used in localized patterns and formatted
    533 //     * strings
    534 //     * @see #getPlusSign
    535 //     * @see #setMinusSign
    536 //     * @see #getMinusSign
    537 //     * @stable ICU 2.0
    538 //     */
    539 //    public void setPlusSign(char plus) {
    540 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    541 //    }
    542 
    543 //    /**
    544 //     * {@icu} Returns the character used to pad numbers out to a specified width.  This is
    545 //     * not the pad character itself; rather, it is the special pattern character
    546 //     * <em>preceding</em> the pad character.  In the pattern "*_#,##0", '*' is the pad
    547 //     * escape, and '_' is the pad character.
    548 //     * @return the character
    549 //     * @see #setPadEscape
    550 //     * @see DecimalFormat#getFormatWidth
    551 //     * @see DecimalFormat#getPadPosition
    552 //     * @see DecimalFormat#getPadCharacter
    553 //     * @stable ICU 2.0
    554 //     */
    555 //    public char getPadEscape() {
    556 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    557 //    }
    558 
    559 //    /**
    560 //     * {@icu} Sets the character used to pad numbers out to a specified width.  This is not
    561 //     * the pad character itself; rather, it is the special pattern character
    562 //     * <em>preceding</em> the pad character.  In the pattern "*_#,##0", '*' is the pad
    563 //     * escape, and '_' is the pad character.
    564 //     * @see #getPadEscape
    565 //     * @see DecimalFormat#setFormatWidth
    566 //     * @see DecimalFormat#setPadPosition
    567 //     * @see DecimalFormat#setPadCharacter
    568 //     * @stable ICU 2.0
    569 //     */
    570 //    public void setPadEscape(char c) {
    571 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    572 //    }
    573 
    574 //    /**
    575 //     * {@icu} Indicates the currency match pattern used in {@link #getPatternForCurrencySpacing}.
    576 //     * @stable ICU 4.2
    577 //     */
    578 //    public static final int CURRENCY_SPC_CURRENCY_MATCH = 0;
    579 //
    580 //    /**
    581 //     * {@icu} Indicates the surrounding match pattern used in {@link
    582 //     * #getPatternForCurrencySpacing}.
    583 //     * @stable ICU 4.2
    584 //     */
    585 //    public static final int CURRENCY_SPC_SURROUNDING_MATCH = 1;
    586 //
    587 //    /**
    588 //     * {@icu} Indicates the insertion value used in {@link #getPatternForCurrencySpacing}.
    589 //     * @stable ICU 4.4
    590 //     */
    591 //    public static final int CURRENCY_SPC_INSERT = 2;
    592 
    593 //    /**
    594 //     * {@icu} Returns the desired currency spacing value. Original values come from ICU's
    595 //     * CLDR data based on the locale provided during construction, and can be null.  These
    596 //     * values govern what and when text is inserted between a currency code/name/symbol
    597 //     * and the currency amount when formatting money.
    598 //     *
    599 //     * <p>For more information, see <a href="http://www.unicode.org/reports/tr35/#Currencies"
    600 //     * >UTS#35 section 5.10.2</a>.
    601 //     *
    602 //     * <p><strong>Note:</strong> ICU4J does not currently use this information.
    603 //     *
    604 //     * @param itemType one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH
    605 //     * or CURRENCY_SPC_INSERT
    606 //     * @param beforeCurrency true to get the <code>beforeCurrency</code> values, false
    607 //     * to get the <code>afterCurrency</code> values.
    608 //     * @return the value, or null.
    609 //     * @see #setPatternForCurrencySpacing(int, boolean, String)
    610 //     * @stable ICU 4.2
    611 //     */
    612 //    public String getPatternForCurrencySpacing(int itemType, boolean beforeCurrency)  {
    613 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    614 //    }
    615 
    616 //    /**
    617 //     * {@icu} Sets the indicated currency spacing pattern or value. See {@link
    618 //     * #getPatternForCurrencySpacing} for more information.
    619 //     *
    620 //     * <p>Values for currency match and surrounding match must be {@link
    621 //     * com.ibm.icu.text.UnicodeSet} patterns. Values for insert can be any string.
    622 //     *
    623 //     * <p><strong>Note:</strong> ICU4J does not currently use this information.
    624 //     *
    625 //     * @param itemType one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH
    626 //     * or CURRENCY_SPC_INSERT
    627 //     * @param beforeCurrency true if the pattern is for before the currency symbol.
    628 //     * false if the pattern is for after it.
    629 //     * @param  pattern string to override current setting; can be null.
    630 //     * @see #getPatternForCurrencySpacing(int, boolean)
    631 //     * @stable ICU 4.2
    632 //     */
    633 //    public void setPatternForCurrencySpacing(int itemType, boolean beforeCurrency, String pattern) {
    634 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    635 //    }
    636 
    637 
    638 //    /**
    639 //     * Returns the locale for which this object was constructed.
    640 //     * @return the locale for which this object was constructed
    641 //     * @stable ICU 2.0
    642 //     */
    643 //    public Locale getLocale() {
    644 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    645 //    }
    646 
    647 //    /**
    648 //     * Returns the locale for which this object was constructed.
    649 //     * @return the locale for which this object was constructed
    650 //     * @stable ICU 3.2
    651 //     */
    652 //    public ULocale getULocale() {
    653 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    654 //    }
    655 
    656 //    /**
    657 //     * {@icu} Returns the locale that was used to create this object, or null.
    658 //     * This may may differ from the locale requested at the time of
    659 //     * this object's creation.  For example, if an object is created
    660 //     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be
    661 //     * drawn from <tt>en</tt> (the <i>actual</i> locale), and
    662 //     * <tt>en_US</tt> may be the most specific locale that exists (the
    663 //     * <i>valid</i> locale).
    664 //     *
    665 //     * <p>Note: The <i>actual</i> locale is returned correctly, but the <i>valid</i>
    666 //     * locale is not, in most cases.
    667 //     * @param type type of information requested, either {@link
    668 //     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link
    669 //     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.
    670 //     * @return the information specified by <i>type</i>, or null if
    671 //     * this object was not constructed from locale data.
    672 //     * @see com.ibm.icu.util.ULocale
    673 //     * @see com.ibm.icu.util.ULocale#VALID_LOCALE
    674 //     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
    675 //     * @draft ICU 2.8 (retain)
    676 //     * @provisional This API might change or be removed in a future release.
    677 //     */
    678 //    public final ULocale getLocale(ULocale.Type type) {
    679 //        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");
    680 //    }
    681 
    682     /**
    683      * Standard override.
    684      * @stable ICU 2.0
    685      */
    686     public Object clone() {
    687         return new DecimalFormatSymbols((java.text.DecimalFormatSymbols)dfs.clone());
    688     }
    689 
    690     /**
    691      * Override equals.
    692      * @stable ICU 2.0
    693      */
    694     public boolean equals(Object obj) {
    695         try {
    696             return dfs.equals(((DecimalFormatSymbols)obj).dfs);
    697         }
    698         catch (Exception e) {
    699             return false;
    700         }
    701     }
    702 
    703     /**
    704      * Override hashCode
    705      * @stable ICU 2.0
    706      */
    707     public int hashCode() {
    708         return dfs.hashCode();
    709     }
    710 }
    711