FileDocCategorySizeDatePackage
DecimalFormatSymbols.javaAPI DocAndroid 1.5 API10372Wed May 06 22:41:04 BST 2009com.ibm.icu4jni.text

DecimalFormatSymbols

public class DecimalFormatSymbols extends Object

Fields Summary
private int
addr
private Locale
loc
Constructors Summary
private DecimalFormatSymbols(int addr, Locale loc)

        this.addr = addr;
        this.loc = loc;
    
public DecimalFormatSymbols(Locale locale)

        this.loc = locale;
        ResourceBundle bundle = AccessController.
        doPrivileged(new PrivilegedAction<ResourceBundle>() {
            public ResourceBundle run() {
            return ResourceBundle.getBundle(
                    "org.apache.harmony.luni.internal.locale.Locale", loc); //$NON-NLS-1$
            }
        });
        String pattern = bundle.getString("Number");
        this.addr = NativeDecimalFormat.openDecimalFormatImpl(
                locale.toString(), pattern);
        String currSymbol = bundle.getString("CurrencySymbol");
        String intCurrSymbol = bundle.getString("IntCurrencySymbol");
        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_CURRENCY_SYMBOL.ordinal(), currSymbol);
        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INTL_CURRENCY_SYMBOL.ordinal(), 
                intCurrSymbol);
    
Methods Summary
public java.lang.Objectclone()

        int addr = NativeDecimalFormat.cloneImpl(this.addr);
        Locale loc = (Locale) this.loc.clone();
        return new DecimalFormatSymbols(addr, loc);
    
public booleanequals(java.lang.Object object)

        if(object == null) {
            return false;
        }
        if(!(object instanceof DecimalFormatSymbols)) {
            return false;
        }
        
        DecimalFormatSymbols sym = (DecimalFormatSymbols) object;
        
        if(sym.addr == this.addr) {
            return true;
        }
        
        boolean result = true;
        
        Currency objCurr = sym.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 &= sym.getCurrencySymbol().equals(this.getCurrencySymbol());
        result &= sym.getDecimalSeparator() == this.getDecimalSeparator();
        result &= sym.getDigit() == this.getDigit();
        result &= sym.getGroupingSeparator() == this.getGroupingSeparator();
        result &= sym.getInfinity().equals(this.getInfinity());
        result &= sym.getInternationalCurrencySymbol().equals(
                this.getInternationalCurrencySymbol());
        result &= sym.getMinusSign() == this.getMinusSign();
        result &= sym.getMonetaryDecimalSeparator() == 
                this.getMonetaryDecimalSeparator();
        result &= sym.getNaN().equals(this.getNaN());
        result &= sym.getPatternSeparator() == this.getPatternSeparator();
        result &= sym.getPercent() == this.getPercent();
        result &= sym.getPerMill() == this.getPerMill();
        result &= sym.getZeroDigit() == this.getZeroDigit();
        
        return result;
    
protected voidfinalize()

        NativeDecimalFormat.closeDecimalFormatImpl(this.addr);
    
intgetAddr()

        return this.addr;
    
public java.util.CurrencygetCurrency()

        String curr = NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INTL_CURRENCY_SYMBOL.ordinal());
        if(curr.equals("") || curr.equals("\u00a4\u00a4")) {
            return null;
        }
         return Currency.getInstance(curr);
    
public java.lang.StringgetCurrencySymbol()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_CURRENCY_SYMBOL.ordinal());
    
public chargetDecimalSeparator()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_DECIMAL_SEPARATOR_SYMBOL.ordinal())
                .charAt(0);
    
public chargetDigit()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_DIGIT_SYMBOL.ordinal())
                .charAt(0);
    
public chargetGroupingSeparator()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_GROUPING_SEPARATOR_SYMBOL.ordinal())
                .charAt(0);
    
public java.lang.StringgetInfinity()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INFINITY_SYMBOL.ordinal());
    
public java.lang.StringgetInternationalCurrencySymbol()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INTL_CURRENCY_SYMBOL.ordinal());
    
java.util.LocalegetLocale()

        return this.loc;
    
public chargetMinusSign()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_MINUS_SIGN_SYMBOL.ordinal())
                .charAt(0);
    
public chargetMonetaryDecimalSeparator()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_MONETARY_SEPARATOR_SYMBOL.ordinal())
                .charAt(0);
    
public java.lang.StringgetNaN()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_NAN_SYMBOL.ordinal());
    
public chargetPatternSeparator()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PATTERN_SEPARATOR_SYMBOL.ordinal())
                .charAt(0);
    
public chargetPerMill()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PERMILL_SYMBOL.ordinal())
                .charAt(0);
    
public chargetPercent()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PERCENT_SYMBOL.ordinal())
                .charAt(0);
    
public chargetZeroDigit()

        return NativeDecimalFormat.getSymbol(this.addr,
                UNumberFormatSymbol.UNUM_ZERO_DIGIT_SYMBOL.ordinal())
                .charAt(0);
    
public voidsetCurrency(java.util.Currency currency)

        NativeDecimalFormat.setSymbol(this.addr,
               UNumberFormatSymbol.UNUM_CURRENCY_SYMBOL.ordinal(), 
               currency.getSymbol());
        NativeDecimalFormat.setSymbol(this.addr,
               UNumberFormatSymbol.UNUM_INTL_CURRENCY_SYMBOL.ordinal(), 
               currency.getCurrencyCode());
    
public voidsetCurrencySymbol(java.lang.String symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_CURRENCY_SYMBOL.ordinal(), 
                symbol);
    
public voidsetDecimalSeparator(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_DECIMAL_SEPARATOR_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetDigit(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_DIGIT_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetGroupingSeparator(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_GROUPING_SEPARATOR_SYMBOL.ordinal(), 
                "" + symbol);
        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetInfinity(java.lang.String symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INFINITY_SYMBOL.ordinal(), 
                symbol);
    
public voidsetInternationalCurrencySymbol(java.lang.String symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_INTL_CURRENCY_SYMBOL.ordinal(), 
                symbol);
    
public voidsetMinusSign(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_MINUS_SIGN_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetMonetaryDecimalSeparator(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_MONETARY_SEPARATOR_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetNaN(java.lang.String symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_NAN_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetPatternSeparator(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PATTERN_SEPARATOR_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetPerMill(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PERMILL_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetPercent(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_PERCENT_SYMBOL.ordinal(), 
                "" + symbol);
    
public voidsetZeroDigit(char symbol)

        NativeDecimalFormat.setSymbol(this.addr,
                UNumberFormatSymbol.UNUM_ZERO_DIGIT_SYMBOL.ordinal(), 
                "" + symbol);