gt:         currency == other.currency &&
context: /*
   * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
   * particular file as subject to the "Classpath" exception as provided
   * by Oracle in the LICENSE file that accompanied this code.
   *
   * This code is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   * version 2 for more details (a copy is included in the LICENSE file that
   * accompanied this code).
   *
   * You should have received a copy of the GNU General Public License version
   * 2 along with this work; if not, write to the Free Software Foundation,
   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   *
   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
  /*
   * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
   * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
   *
   *   The original version of this source code and documentation is copyrighted
   * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
   * materials are provided under terms of a License Agreement between Taligent
   * and Sun. This technology is protected by multiple US and International
   * patents. This notice and attribution to Taligent may not be removed.
   *   Taligent is a registered trademark of Taligent, Inc.
   *
   */
  
  package java.text;
  
  import java.io.IOException;
  import java.io.ObjectInputStream;
  import java.io.Serializable;
  import java.text.spi.DecimalFormatSymbolsProvider;
  import java.util.Currency;
  import java.util.Locale;
  import sun.util.locale.provider.LocaleProviderAdapter;
  import sun.util.locale.provider.LocaleServiceProviderPool;
  import sun.util.locale.provider.ResourceBundleBasedAdapter;
  
  /**
   * This class represents the set of symbols (such as the decimal separator,
   * the grouping separator, and so on) needed by <code>DecimalFormat</code>
   * to format numbers. <code>DecimalFormat</code> creates for itself an instance of
   * <code>DecimalFormatSymbols</code> from its locale data.  If you need to change any
   * of these symbols, you can get the <code>DecimalFormatSymbols</code> object from
   * your <code>DecimalFormat</code> and modify it.
   *
   * @see          java.util.Locale
   * @see          DecimalFormat
   * @author       Mark Davis
   * @author       Alan Liu
   * @since 1.1
   */
  
  public class DecimalFormatSymbols implements Cloneable, Serializable {
  
      /**
       * Create a DecimalFormatSymbols object for the default
       * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
       * This constructor can only construct instances for the locales
       * supported by the Java runtime environment, not for those
       * supported by installed
       * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
       * implementations. For full locale coverage, use the
       * {@link #getInstance(Locale) getInstance} method.
       * <p>This is equivalent to calling
       * {@link #DecimalFormatSymbols(Locale)
       *     DecimalFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
       * @see java.util.Locale#getDefault(java.util.Locale.Category)
       * @see java.util.Locale.Category#FORMAT
       */
      public DecimalFormatSymbols() {
          initialize( Locale.getDefault(Locale.Category.FORMAT) );
      }
  
      /**
       * Create a DecimalFormatSymbols object for the given locale.
       * This constructor can only construct instances for the locales
       * supported by the Java runtime environment, not for those
       * supported by installed
       * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
       * implementations. For full locale coverage, use the
       * {@link #getInstance(Locale) getInstance} method.
       * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
       * for the numbering system, the instance is initialized with the specified numbering
       * system if the JRE implementation supports it. For example,
       * <pre>
       * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
       * </pre>
       * This may return a {@code NumberFormat} instance with the Thai numbering system,
       * instead of the Latin numbering system.
       *
       * @param locale the desired locale
       * @exception NullPointerException if <code>locale</code> is null
       */
      public DecimalFormatSymbols( Locale locale ) {
          initialize( locale );
      }
  
      /**
       * Returns an array of all locales for which the
       * <code>getInstance</code> methods of this class can return
       * localized instances.
       * The returned array represents the union of locales supported by the Java
       * runtime and by installed
       * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
       * implementations.  It must contain at least a <code>Locale</code>
       * instance equal to {@link java.util.Locale#US Locale.US}.
       *
       * @return an array of locales for which localized
       *         <code>DecimalFormatSymbols</code> instances are available.
       * @since 1.6
       */
      public static Locale[] getAvailableLocales() {
          LocaleServiceProviderPool pool =
              LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
          return pool.getAvailableLocales();
      }
  
      /**
       * Gets the <code>DecimalFormatSymbols</code> instance for the default
       * locale.  This method provides access to <code>DecimalFormatSymbols</code>
       * instances for locales supported by the Java runtime itself as well
       * as for those supported by installed
       * {@link java.text.spi.DecimalFormatSymbolsProvider
       * DecimalFormatSymbolsProvider} implementations.
       * <p>This is equivalent to calling
       * {@link #getInstance(Locale)
       *     getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
       * @see java.util.Locale#getDefault(java.util.Locale.Category)
       * @see java.util.Locale.Category#FORMAT
       * @return a <code>DecimalFormatSymbols</code> instance.
       * @since 1.6
       */
      public static final DecimalFormatSymbols getInstance() {
          return getInstance(Locale.getDefault(Locale.Category.FORMAT));
      }
  
      /**
       * Gets the <code>DecimalFormatSymbols</code> instance for the specified
       * locale.  This method provides access to <code>DecimalFormatSymbols</code>
       * instances for locales supported by the Java runtime itself as well
       * as for those supported by installed
       * {@link java.text.spi.DecimalFormatSymbolsProvider
       * DecimalFormatSymbolsProvider} implementations.
       * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
       * for the numbering system, the instance is initialized with the specified numbering
       * system if the JRE implementation supports it. For example,
       * <pre>
       * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
       * </pre>
       * This may return a {@code NumberFormat} instance with the Thai numbering system,
       * instead of the Latin numbering system.
       *
       * @param locale the desired locale.
       * @return a <code>DecimalFormatSymbols</code> instance.
       * @exception NullPointerException if <code>locale</code> is null
       * @since 1.6
       */
      public static final DecimalFormatSymbols getInstance(Locale locale) {
          LocaleProviderAdapter adapter;
          adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
          DecimalFormatSymbolsProvider provider = adapter.getDecimalFormatSymbolsProvider();
          DecimalFormatSymbols dfsyms = provider.getInstance(locale);
          if (dfsyms == null) {
              provider = LocaleProviderAdapter.forJRE().getDecimalFormatSymbolsProvider();
              dfsyms = provider.getInstance(locale);
          }
          return dfsyms;
      }
  
      /**
       * Gets the character used for zero. Different for Arabic, etc.
       *
       * @return the character used for zero
       */
      public char getZeroDigit() {
          return zeroDigit;
      }
  
      /**
       * Sets the character used for zero. Different for Arabic, etc.
       *
       * @param zeroDigit the character used for zero
       */
      public void setZeroDigit(char zeroDigit) {
          this.zeroDigit = zeroDigit;
      }
  
      /**
       * Gets the character used for thousands separator. Different for French, etc.
       *
       * @return the grouping separator
       */
      public char getGroupingSeparator() {
          return groupingSeparator;
      }
  
      /**
       * Sets the character used for thousands separator. Different for French, etc.
       *
       * @param groupingSeparator the grouping separator
       */
      public void setGroupingSeparator(char groupingSeparator) {
          this.groupingSeparator = groupingSeparator;
      }
  
      /**
       * Gets the character used for decimal sign. Different for French, etc.
       *
       * @return the character used for decimal sign
       */
      public char getDecimalSeparator() {
          return decimalSeparator;
      }
  
      /**
       * Sets the character used for decimal sign. Different for French, etc.
       *
       * @param decimalSeparator the character used for decimal sign
       */
      public void setDecimalSeparator(char decimalSeparator) {
          this.decimalSeparator = decimalSeparator;
      }
  
      /**
       * Gets the character used for per mille sign. Different for Arabic, etc.
       *
       * @return the character used for per mille sign
       */
      public char getPerMill() {
          return perMill;
      }
  
      /**
       * Sets the character used for per mille sign. Different for Arabic, etc.
       *
       * @param perMill the character used for per mille sign
       */
      public void setPerMill(char perMill) {
          this.perMill = perMill;
      }
  
      /**
       * Gets the character used for percent sign. Different for Arabic, etc.
       *
       * @return the character used for percent sign
       */
      public char getPercent() {
          return percent;
      }
  
      /**
       * Sets the character used for percent sign. Different for Arabic, etc.
       *
       * @param percent the character used for percent sign
       */
      public void setPercent(char percent) {
          this.percent = percent;
      }
  
      /**
       * Gets the character used for a digit in a pattern.
       *
       * @return the character used for a digit in a pattern
       */
      public char getDigit() {
          return digit;
      }
  
      /**
       * Sets the character used for a digit in a pattern.
       *
       * @param digit the character used for a digit in a pattern
       */
      public void setDigit(char digit) {
          this.digit = digit;
      }
  
      /**
       * Gets the character used to separate positive and negative subpatterns
       * in a pattern.
       *
       * @return the pattern separator
       */
      public char getPatternSeparator() {
          return patternSeparator;
      }
  
      /**
       * Sets the character used to separate positive and negative subpatterns
       * in a pattern.
       *
       * @param patternSeparator the pattern separator
       */
      public void setPatternSeparator(char patternSeparator) {
          this.patternSeparator = patternSeparator;
      }
  
      /**
       * Gets the string used to represent infinity. Almost always left
       * unchanged.
       *
       * @return the string representing infinity
       */
      public String getInfinity() {
          return infinity;
      }
  
      /**
       * Sets the string used to represent infinity. Almost always left
       * unchanged.
       *
       * @param infinity the string representing infinity
       */
      public void setInfinity(String infinity) {
          this.infinity = infinity;
      }
  
      /**
       * Gets the string used to represent "not a number". Almost always left
       * unchanged.
       *
       * @return the string representing "not a number"
       */
      public String getNaN() {
          return NaN;
      }
  
      /**
       * Sets the string used to represent "not a number". Almost always left
       * unchanged.
       *
       * @param NaN the string representing "not a number"
       */
      public void setNaN(String NaN) {
          this.NaN = NaN;
      }
  
      /**
       * Gets the character used to represent minus sign. If no explicit
       * negative format is specified, one is formed by prefixing
       * minusSign to the positive format.
       *
       * @return the character representing minus sign
       */
      public char getMinusSign() {
          return minusSign;
      }
  
      /**
       * Sets the character used to represent minus sign. If no explicit
       * negative format is specified, one is formed by prefixing
       * minusSign to the positive format.
       *
       * @param minusSign the character representing minus sign
       */
      public void setMinusSign(char minusSign) {
          this.minusSign = minusSign;
      }
  
      /**
       * Returns the currency symbol for the currency of these
       * DecimalFormatSymbols in their locale.
       *
       * @return the currency symbol
       * @since 1.2
       */
      public String getCurrencySymbol()
      {
          initializeCurrency(locale);
          return currencySymbol;
      }
  
      /**
       * Sets the currency symbol for the currency of these
       * DecimalFormatSymbols in their locale.
       *
       * @param currency the currency symbol
       * @since 1.2
       */
      public void setCurrencySymbol(String currency)
      {
          initializeCurrency(locale);
          currencySymbol = currency;
      }
  
      /**
       * Returns the ISO 4217 currency code of the currency of these
       * DecimalFormatSymbols.
       *
       * @return the currency code
       * @since 1.2
       */
      public String getInternationalCurrencySymbol()
      {
          initializeCurrency(locale);
          return intlCurrencySymbol;
      }
  
      /**
       * Sets the ISO 4217 currency code of the currency of these
       * DecimalFormatSymbols.
       * If the currency code is valid (as defined by
       * {@link java.util.Currency#getInstance(java.lang.String) Currency.getInstance}),
       * this also sets the currency attribute to the corresponding Currency
       * instance and the currency symbol attribute to the currency's symbol
       * in the DecimalFormatSymbols' locale. If the currency code is not valid,
       * then the currency attribute is set to null and the currency symbol
       * attribute is not modified.
       *
       * @param currencyCode the currency code
       * @see #setCurrency
       * @see #setCurrencySymbol
       * @since 1.2
       */
      public void setInternationalCurrencySymbol(String currencyCode)
      {
          initializeCurrency(locale);
          intlCurrencySymbol = currencyCode;
          currency = null;
          if (currencyCode != null) {
              try {
                  currency = Currency.getInstance(currencyCode);
                  currencySymbol = currency.getSymbol();
              } catch (IllegalArgumentException e) {
              }
          }
      }
  
      /**
       * Gets the currency of these DecimalFormatSymbols. May be null if the
       * currency symbol attribute was previously set to a value that's not
       * a valid ISO 4217 currency code.
       *
       * @return the currency used, or null
       * @since 1.4
       */
      public Currency getCurrency() {
          initializeCurrency(locale);
          return currency;
      }
  
      /**
       * Sets the currency of these DecimalFormatSymbols.
       * 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.
       *
       * @param currency the new currency to be used
       * @exception NullPointerException if <code>currency</code> is null
       * @since 1.4
       * @see #setCurrencySymbol
       * @see #setInternationalCurrencySymbol
       */
      public void setCurrency(Currency currency) {
          if (currency == null) {
              throw new NullPointerException();
          }
          initializeCurrency(locale);
          this.currency = currency;
          intlCurrencySymbol = currency.getCurrencyCode();
          currencySymbol = currency.getSymbol(locale);
      }
  
  
      /**
       * Returns the monetary decimal separator.
       *
       * @return the monetary decimal separator
       * @since 1.2
       */
      public char getMonetaryDecimalSeparator()
      {
          return monetarySeparator;
      }
  
      /**
       * Sets the monetary decimal separator.
       *
       * @param sep the monetary decimal separator
       * @since 1.2
       */
      public void setMonetaryDecimalSeparator(char sep)
      {
          monetarySeparator = sep;
      }
  
      //------------------------------------------------------------
      // BEGIN   Package Private methods ... to be made public later
      //------------------------------------------------------------
  
      /**
       * Returns the character used to separate the mantissa from the exponent.
       */
      char getExponentialSymbol()
      {
          return exponential;
      }
  
      /**
       * Returns the string used to separate the mantissa from the exponent.
       * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
       *
       * @return the exponent separator string
       * @see #setExponentSeparator(java.lang.String)
       * @since 1.6
       */
      public String getExponentSeparator()
      {
          return exponentialSeparator;
      }
  
      /**
       * Sets the character used to separate the mantissa from the exponent.
       */
      void setExponentialSymbol(char exp)
      {
          exponential = exp;
      }
  
      /**
       * Sets the string used to separate the mantissa from the exponent.
       * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
       *
       * @param exp the exponent separator string
       * @exception NullPointerException if <code>exp</code> is null
       * @see #getExponentSeparator()
       * @since 1.6
       */
      public void setExponentSeparator(String exp)
      {
          if (exp == null) {
              throw new NullPointerException();
          }
          exponentialSeparator = exp;
      }
  
  
      //------------------------------------------------------------
      // END     Package Private methods ... to be made public later
      //------------------------------------------------------------
  
      /**
       * Standard override.
       */
      @Override
      public Object clone() {
          try {
              return (DecimalFormatSymbols)super.clone();
              // other fields are bit-copied
          } catch (CloneNotSupportedException e) {
              throw new InternalError(e);
          }
      }
  
      /**
       * Override equals.
       */
      @Override
      public boolean equals(Object obj) {
          if (obj == null) return false;
          if (this == obj) return true;
          if (getClass() != obj.getClass()) return false;
          DecimalFormatSymbols other = (DecimalFormatSymbols) obj;
          return (zeroDigit == other.zeroDigit &&
          groupingSeparator == other.groupingSeparator &&
          decimalSeparator == other.decimalSeparator &&
          percent == other.percent &&
          perMill == other.perMill &&
          digit == other.digit &&
          minusSign == other.minusSign &&
          patternSeparator == other.patternSeparator &&
          infinity.equals(other.infinity) &&
          NaN.equals(other.NaN) &&
          getCurrencySymbol().equals(other.getCurrencySymbol()) && // possible currency init occurs here
          intlCurrencySymbol.equals(other.intlCurrencySymbol) &&
  