Class NumbersImpl
- java.lang.Object
-
- com.squarespace.cldrengine.numbers.NumbersImpl
-
-
Field Summary
Fields Modifier and Type Field Description Bundle
bundle
GeneralInternals
general
NumberInternals
numbers
PrivateApi
privateApi
-
Constructor Summary
Constructors Constructor Description NumbersImpl(Bundle bundle, Internals internals, PrivateApi privateApi)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Decimal
adjustDecimal(Decimal num)
Adjusts a decimal number using the given options.Decimal
adjustDecimal(Decimal num, DecimalAdjustOptions options)
Adjusts a decimal number using the given options.protected static <T> boolean
arrayContains(T[] arr, T t)
java.lang.String
formatCurrency(Decimal n, CurrencyType code)
Formats a currency value to string.java.lang.String
formatCurrency(Decimal n, CurrencyType code, CurrencyFormatOptions options)
Formats a currency value to string.protected <T> T
formatCurrencyImpl(NumberRenderer<T> renderer, NumberParams params, Decimal n, CurrencyType code, CurrencyFormatOptions options)
java.util.List<Part>
formatCurrencyToParts(Decimal n, CurrencyType code)
Formats a currency value to an array of parts.java.util.List<Part>
formatCurrencyToParts(Decimal n, CurrencyType code, CurrencyFormatOptions options)
Formats a currency value to an array of parts.java.lang.String
formatDecimal(Decimal n)
Formats a decimal number to string.java.lang.String
formatDecimal(Decimal n, DecimalFormatOptions options)
Formats a decimal number to string.protected <T> T
formatDecimalImpl(NumberRenderer<T> renderer, NumberParams params, Decimal n, DecimalFormatOptions options)
java.util.List<Part>
formatDecimalToParts(Decimal n)
Formats a decimal number to an array of parts.java.util.List<Part>
formatDecimalToParts(Decimal n, DecimalFormatOptions options)
Formats a decimal number to an array of parts.java.lang.String
getCurrencyDisplayName(CurrencyType code)
Returns the display name of the currency.java.lang.String
getCurrencyDisplayName(CurrencyType code, CurrencyDisplayNameOptions options)
Returns the display name of the currency.CurrencyType
getCurrencyForRegion(java.lang.String region)
Return the currency code to use for a given region.CurrencyFractions
getCurrencyFractions(CurrencyType code)
Return the currency fraction info for a given currency code.java.lang.String
getCurrencyPluralName(Decimal n, CurrencyType code)
Returns the pluralized display name of the currency.java.lang.String
getCurrencyPluralName(Decimal n, CurrencyType code, CurrencyDisplayNameOptions options)
Returns the pluralized display name of the currency.java.lang.String
getCurrencySymbol(CurrencyType code)
Returns the currency symbol of the given width.java.lang.String
getCurrencySymbol(CurrencyType code, CurrencySymbolWidthType width)
Returns the currency symbol of the given width.PluralType
getPluralCardinal(Decimal n)
Returns the plural cardinal category of the given decimal number.PluralType
getPluralCardinal(Decimal n, DecimalAdjustOptions options)
Returns the plural cardinal category of the given decimal number.PluralType
getPluralOrdinal(Decimal n)
Returns the plural ordinal category of the given decimal number.PluralType
getPluralOrdinal(Decimal n, DecimalAdjustOptions options)
Returns the plural ordinal category of the given decimal number.protected <T> T
validate(Decimal n, DecimalFormatOptions options, NumberRenderer<T> renderer, NumberParams params)
-
-
-
Field Detail
-
bundle
public final Bundle bundle
-
numbers
public final NumberInternals numbers
-
general
public final GeneralInternals general
-
privateApi
public final PrivateApi privateApi
-
-
Constructor Detail
-
NumbersImpl
public NumbersImpl(Bundle bundle, Internals internals, PrivateApi privateApi)
-
-
Method Detail
-
adjustDecimal
public Decimal adjustDecimal(Decimal num)
Description copied from interface:Numbers
Adjusts a decimal number using the given options.- Specified by:
adjustDecimal
in interfaceNumbers
-
adjustDecimal
public Decimal adjustDecimal(Decimal num, DecimalAdjustOptions options)
Description copied from interface:Numbers
Adjusts a decimal number using the given options.- Specified by:
adjustDecimal
in interfaceNumbers
-
formatDecimal
public java.lang.String formatDecimal(Decimal n)
Description copied from interface:Numbers
Formats a decimal number to string.- Specified by:
formatDecimal
in interfaceNumbers
-
formatDecimal
public java.lang.String formatDecimal(Decimal n, DecimalFormatOptions options)
Description copied from interface:Numbers
Formats a decimal number to string.- Specified by:
formatDecimal
in interfaceNumbers
-
formatDecimalToParts
public java.util.List<Part> formatDecimalToParts(Decimal n)
Description copied from interface:Numbers
Formats a decimal number to an array of parts.- Specified by:
formatDecimalToParts
in interfaceNumbers
-
formatDecimalToParts
public java.util.List<Part> formatDecimalToParts(Decimal n, DecimalFormatOptions options)
Description copied from interface:Numbers
Formats a decimal number to an array of parts.- Specified by:
formatDecimalToParts
in interfaceNumbers
-
formatCurrency
public java.lang.String formatCurrency(Decimal n, CurrencyType code)
Description copied from interface:Numbers
Formats a currency value to string.- Specified by:
formatCurrency
in interfaceNumbers
-
formatCurrency
public java.lang.String formatCurrency(Decimal n, CurrencyType code, CurrencyFormatOptions options)
Description copied from interface:Numbers
Formats a currency value to string.- Specified by:
formatCurrency
in interfaceNumbers
-
formatCurrencyToParts
public java.util.List<Part> formatCurrencyToParts(Decimal n, CurrencyType code)
Description copied from interface:Numbers
Formats a currency value to an array of parts.- Specified by:
formatCurrencyToParts
in interfaceNumbers
-
formatCurrencyToParts
public java.util.List<Part> formatCurrencyToParts(Decimal n, CurrencyType code, CurrencyFormatOptions options)
Description copied from interface:Numbers
Formats a currency value to an array of parts.- Specified by:
formatCurrencyToParts
in interfaceNumbers
-
getCurrencySymbol
public java.lang.String getCurrencySymbol(CurrencyType code)
Description copied from interface:Numbers
Returns the currency symbol of the given width.- Specified by:
getCurrencySymbol
in interfaceNumbers
-
getCurrencySymbol
public java.lang.String getCurrencySymbol(CurrencyType code, CurrencySymbolWidthType width)
Description copied from interface:Numbers
Returns the currency symbol of the given width.- Specified by:
getCurrencySymbol
in interfaceNumbers
-
getCurrencyDisplayName
public java.lang.String getCurrencyDisplayName(CurrencyType code)
Description copied from interface:Numbers
Returns the display name of the currency.- Specified by:
getCurrencyDisplayName
in interfaceNumbers
-
getCurrencyDisplayName
public java.lang.String getCurrencyDisplayName(CurrencyType code, CurrencyDisplayNameOptions options)
Description copied from interface:Numbers
Returns the display name of the currency.- Specified by:
getCurrencyDisplayName
in interfaceNumbers
-
getCurrencyPluralName
public java.lang.String getCurrencyPluralName(Decimal n, CurrencyType code)
Description copied from interface:Numbers
Returns the pluralized display name of the currency.- Specified by:
getCurrencyPluralName
in interfaceNumbers
-
getCurrencyPluralName
public java.lang.String getCurrencyPluralName(Decimal n, CurrencyType code, CurrencyDisplayNameOptions options)
Description copied from interface:Numbers
Returns the pluralized display name of the currency.- Specified by:
getCurrencyPluralName
in interfaceNumbers
-
getCurrencyFractions
public CurrencyFractions getCurrencyFractions(CurrencyType code)
Description copied from interface:Numbers
Return the currency fraction info for a given currency code.- Specified by:
getCurrencyFractions
in interfaceNumbers
-
getCurrencyForRegion
public CurrencyType getCurrencyForRegion(java.lang.String region)
Description copied from interface:Numbers
Return the currency code to use for a given region.- Specified by:
getCurrencyForRegion
in interfaceNumbers
-
getPluralCardinal
public PluralType getPluralCardinal(Decimal n)
Description copied from interface:Numbers
Returns the plural cardinal category of the given decimal number.- Specified by:
getPluralCardinal
in interfaceNumbers
-
getPluralCardinal
public PluralType getPluralCardinal(Decimal n, DecimalAdjustOptions options)
Description copied from interface:Numbers
Returns the plural cardinal category of the given decimal number.- Specified by:
getPluralCardinal
in interfaceNumbers
-
getPluralOrdinal
public PluralType getPluralOrdinal(Decimal n)
Description copied from interface:Numbers
Returns the plural ordinal category of the given decimal number.- Specified by:
getPluralOrdinal
in interfaceNumbers
-
getPluralOrdinal
public PluralType getPluralOrdinal(Decimal n, DecimalAdjustOptions options)
Description copied from interface:Numbers
Returns the plural ordinal category of the given decimal number.- Specified by:
getPluralOrdinal
in interfaceNumbers
-
formatDecimalImpl
protected <T> T formatDecimalImpl(NumberRenderer<T> renderer, NumberParams params, Decimal n, DecimalFormatOptions options)
-
formatCurrencyImpl
protected <T> T formatCurrencyImpl(NumberRenderer<T> renderer, NumberParams params, Decimal n, CurrencyType code, CurrencyFormatOptions options)
-
validate
protected <T> T validate(Decimal n, DecimalFormatOptions options, NumberRenderer<T> renderer, NumberParams params)
-
arrayContains
protected static <T> boolean arrayContains(T[] arr, T t)
-
-