Esempio n. 1
0
 @Override
 public Object clone() {
   String pat = this.toPattern();
   Locale loc = this.symbols.getLocale();
   DecimalFormatSymbols sym = (DecimalFormatSymbols) this.symbols.clone();
   DecimalFormat newdf = new DecimalFormat(pat, sym);
   newdf.setMaximumIntegerDigits(this.getMaximumIntegerDigits());
   newdf.setMaximumFractionDigits(this.getMaximumFractionDigits());
   newdf.setMinimumIntegerDigits(this.getMinimumIntegerDigits());
   newdf.setMinimumFractionDigits(this.getMinimumFractionDigits());
   newdf.setGroupingUsed(this.isGroupingUsed());
   newdf.setGroupingSize(this.getGroupingSize());
   return newdf;
 }
Esempio n. 2
0
  @Override
  public boolean equals(Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof DecimalFormat)) {
      return false;
    }
    DecimalFormat obj = (DecimalFormat) object;

    if (obj.addr == this.addr) {
      return true;
    }

    boolean result = super.equals(object);

    result &= obj.toPattern().equals(this.toPattern());
    result &= obj.isDecimalSeparatorAlwaysShown() == this.isDecimalSeparatorAlwaysShown();
    result &= obj.getGroupingSize() == this.getGroupingSize();
    result &= obj.getMultiplier() == this.getMultiplier();
    result &= obj.getNegativePrefix().equals(this.getNegativePrefix());
    result &= obj.getNegativeSuffix().equals(this.getNegativeSuffix());
    result &= obj.getPositivePrefix().equals(this.getPositivePrefix());
    result &= obj.getPositiveSuffix().equals(this.getPositiveSuffix());
    result &= obj.getMaximumIntegerDigits() == this.getMaximumIntegerDigits();
    result &= obj.getMaximumFractionDigits() == this.getMaximumFractionDigits();
    result &= obj.getMinimumIntegerDigits() == this.getMinimumIntegerDigits();
    result &= obj.getMinimumFractionDigits() == this.getMinimumFractionDigits();
    result &= obj.isGroupingUsed() == this.isGroupingUsed();
    Currency objCurr = obj.getCurrency();
    Currency thisCurr = this.getCurrency();
    if (objCurr != null) {
      result &= objCurr.getCurrencyCode().equals(thisCurr.getCurrencyCode());
      result &= objCurr.getSymbol().equals(thisCurr.getSymbol());
      result &= objCurr.getDefaultFractionDigits() == thisCurr.getDefaultFractionDigits();
    } else {
      result &= thisCurr == null;
    }
    result &= obj.getDecimalFormatSymbols().equals(this.getDecimalFormatSymbols());

    return result;
  }