//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "patterns") public void test_ofPattern(String pattern, double value, String expected)
        public virtual void test_ofPattern(string pattern, double value, string expected)
        {
            string java   = (new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(Locale.ENGLISH))).format(value);
            string strata = NumberFormatter.ofPattern(pattern, Locale.ENGLISH).format(value);

            assertEquals(strata, java);
            assertEquals(strata, expected);
        }
        public char getDecimalSeparator()
        {
            if (_format == null)
            {
                _format = DecimalFormatSymbols.getInstance(_locale);
            }

            return(_format.getDecimalSeparator());
        }
Exemple #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void listSegments() throws java.io.IOException
        public virtual void listSegments()
        {
            DecimalFormat formatter = new DecimalFormat("###,###.###", DecimalFormatSymbols.getInstance(Locale.ROOT));

            for (int x = 0; x < infos.size(); x++)
            {
                SegmentCommitInfo info    = infos.info(x);
                string            sizeStr = formatter.format(info.sizeInBytes());
                Console.WriteLine(info.info.name + " " + sizeStr);
            }
        }
Exemple #4
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains a formatter based on a pattern in the specified locale.
 /// </summary>
 /// <param name="pattern">  the pattern string to use </param>
 /// <param name="locale">  the locale to use </param>
 /// <returns> the formatter </returns>
 /// <exception cref="IllegalArgumentException"> if the pattern is invalid </exception>
 /// <seealso cref= DecimalFormat </seealso>
 public static NumberFormatter ofPattern(string pattern, Locale locale)
 {
     ArgChecker.notNull(pattern, "pattern");
     ArgChecker.notNull(locale, "locale");
     return(new NumberFormatter(new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(locale))));
 }