Пример #1
0
        /// <summary>
        /// Constructs a new DecimalFormat for formatting and parsing numbers for the
        /// default Locale.
        /// </summary>
        ///
        public DecimalFormat()
        {
            this.parseBigDecimal       = false;
            this.serialVersionOnStream = 3;
            ILOG.J2CsMapping.Util.Locale locale = ILOG.J2CsMapping.Util.Locale.GetDefault();
            icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols(locale);
            symbols    = new DecimalFormatSymbols(locale);
            dform      = new IBM.ICU.Text.DecimalFormat();

            base.SetMaximumFractionDigits(dform.GetMaximumFractionDigits());
            base.SetMaximumIntegerDigits(dform.GetMaximumIntegerDigits());
            base.SetMinimumFractionDigits(dform.GetMinimumFractionDigits());
            base.SetMinimumIntegerDigits(dform.GetMinimumIntegerDigits());
        }
Пример #2
0
        /// <summary>
        /// Constructs a new DecimalFormat using the specified non-localized pattern
        /// and DecimalFormatSymbols.
        /// </summary>
        ///
        /// <param name="pattern">the non-localized pattern</param>
        /// <param name="value">the DecimalFormatSymbols</param>
        /// <exception cref="IllegalArgumentException">when the pattern cannot be parsed</exception>
        public DecimalFormat(String pattern, DecimalFormatSymbols value_ren)
        {
            this.parseBigDecimal       = false;
            this.serialVersionOnStream = 3;
            symbols = (DecimalFormatSymbols)value_ren.Clone();
            ILOG.J2CsMapping.Util.Locale locale = symbols.GetLocale(); //$NON-NLS-1$
            icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols(locale);
            CopySymbols(icuSymbols, symbols);

            dform = new IBM.ICU.Text.DecimalFormat(pattern, icuSymbols);

            base.SetMaximumFractionDigits(dform.GetMaximumFractionDigits());
            base.SetMaximumIntegerDigits(dform.GetMaximumIntegerDigits());
            base.SetMinimumFractionDigits(dform.GetMinimumFractionDigits());
            base.SetMinimumIntegerDigits(dform.GetMinimumIntegerDigits());
        }