Java Code Examples for java.text.DecimalFormatSymbols#setInfinity()
The following examples show how to use
java.text.DecimalFormatSymbols#setInfinity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NumberFormatter.java From birt with Eclipse Public License 1.0 | 6 votes |
private DecimalFormatSymbols getICUDecimalSymbols( Locale locale ) { DecimalFormatSymbols symbols = new DecimalFormatSymbols( locale ); com.ibm.icu.text.DecimalFormatSymbols icuSymbols = new com.ibm.icu.text.DecimalFormatSymbols( locale ); symbols.setCurrencySymbol( icuSymbols.getCurrencySymbol( ) ); symbols.setDecimalSeparator( icuSymbols.getDecimalSeparator( ) ); symbols.setDigit( icuSymbols.getDigit( ) ); symbols.setGroupingSeparator( icuSymbols.getGroupingSeparator( ) ); symbols.setInfinity( icuSymbols.getInfinity( ) ); symbols.setInternationalCurrencySymbol( icuSymbols .getInternationalCurrencySymbol( ) ); symbols.setMinusSign( icuSymbols.getMinusSign( ) ); symbols.setMonetaryDecimalSeparator( icuSymbols .getMonetaryDecimalSeparator( ) ); symbols.setNaN( icuSymbols.getNaN( ) ); symbols.setPatternSeparator( icuSymbols.getPatternSeparator( ) ); symbols.setPercent( icuSymbols.getPercent( ) ); symbols.setPerMill( icuSymbols.getPerMill( ) ); symbols.setZeroDigit( icuSymbols.getZeroDigit( ) ); return symbols; }
Example 2
Source File: StringFormatting.java From thunderstorm with GNU General Public License v3.0 | 5 votes |
public static DecimalFormat getDecimalFormat(int floatPrecision) { DecimalFormat df = new DecimalFormat(); DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(Locale.US); symbols.setInfinity("Infinity"); symbols.setNaN("NaN"); df.setDecimalFormatSymbols(symbols); df.setGroupingUsed(false); df.setRoundingMode(RoundingMode.HALF_EVEN); df.setMaximumFractionDigits(floatPrecision); return df; }
Example 3
Source File: BumbleBench.java From bumblebench with Apache License 2.0 | 4 votes |
private static DecimalFormat initOneDecimalPlace() { DecimalFormatSymbols sym = new DecimalFormatSymbols(); sym.setInfinity("inf"); return new DecimalFormat("0.0", sym); }
Example 4
Source File: SakaiDecimalFormatSymbolsProvider.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public DecimalFormatSymbols getInstance(final Locale locale) throws IllegalArgumentException, NullPointerException { if (locale == null) { throw new NullPointerException("locale:null"); } else if (!SakaiLocaleServiceProviderUtil.isAvailableLocale(locale)) { throw new IllegalArgumentException("locale:" + locale.toString()); } DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("DecimalSeparator", locale)); symbols.setDigit( SakaiLocaleServiceProviderUtil.getChar("Digit", locale)); symbols.setExponentSeparator( SakaiLocaleServiceProviderUtil.getString("ExponentSeparator", locale)); symbols.setGroupingSeparator( SakaiLocaleServiceProviderUtil.getChar("GroupingSeparator", locale)); symbols.setInfinity( SakaiLocaleServiceProviderUtil.getString("Infinity", locale)); symbols.setInternationalCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("InternationalCurrencySymbol", locale)); symbols.setCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("CurrencySymbol", locale)); symbols.setMinusSign( SakaiLocaleServiceProviderUtil.getChar("MinusSign", locale)); symbols.setMonetaryDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("MonetaryDecimalSeparator", locale)); symbols.setNaN( SakaiLocaleServiceProviderUtil.getString("NaN", locale)); symbols.setPatternSeparator( SakaiLocaleServiceProviderUtil.getChar("PatternSeparator", locale)); symbols.setPercent( SakaiLocaleServiceProviderUtil.getChar("Percent", locale)); symbols.setPerMill( SakaiLocaleServiceProviderUtil.getChar("PerMill", locale)); symbols.setZeroDigit( SakaiLocaleServiceProviderUtil.getChar("ZeroDigit", locale)); return symbols; }
Example 5
Source File: SakaiDecimalFormatSymbolsProvider.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public DecimalFormatSymbols getInstance(final Locale locale) throws IllegalArgumentException, NullPointerException { if (locale == null) { throw new NullPointerException("locale:null"); } else if (!SakaiLocaleServiceProviderUtil.isAvailableLocale(locale)) { throw new IllegalArgumentException("locale:" + locale.toString()); } DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("DecimalSeparator", locale)); symbols.setDigit( SakaiLocaleServiceProviderUtil.getChar("Digit", locale)); symbols.setExponentSeparator( SakaiLocaleServiceProviderUtil.getString("ExponentSeparator", locale)); symbols.setGroupingSeparator( SakaiLocaleServiceProviderUtil.getChar("GroupingSeparator", locale)); symbols.setInfinity( SakaiLocaleServiceProviderUtil.getString("Infinity", locale)); symbols.setInternationalCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("InternationalCurrencySymbol", locale)); symbols.setCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("CurrencySymbol", locale)); symbols.setMinusSign( SakaiLocaleServiceProviderUtil.getChar("MinusSign", locale)); symbols.setMonetaryDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("MonetaryDecimalSeparator", locale)); symbols.setNaN( SakaiLocaleServiceProviderUtil.getString("NaN", locale)); symbols.setPatternSeparator( SakaiLocaleServiceProviderUtil.getChar("PatternSeparator", locale)); symbols.setPercent( SakaiLocaleServiceProviderUtil.getChar("Percent", locale)); symbols.setPerMill( SakaiLocaleServiceProviderUtil.getChar("PerMill", locale)); symbols.setZeroDigit( SakaiLocaleServiceProviderUtil.getChar("ZeroDigit", locale)); return symbols; }
Example 6
Source File: StrictDecimalFormat.java From rapidminer-studio with GNU Affero General Public License v3.0 | 2 votes |
/** * Sets the infinity symbol string of this number format. * * @param infinityString * the infinity string representation * @since 8.2.1 */ public void setInfinityString(String infinityString) { DecimalFormatSymbols symbols = getDecimalFormatSymbols(); symbols.setInfinity(infinityString); setDecimalFormatSymbols(symbols); }