Top Description Inners Fields Constructors Methods
com.ibm.icu.impl.number

public Class CompactData

extends Object
implements MultiplierProducer
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.number.MultiplierProducer
Imports
java.util.Arrays, .Map, .Set, com.ibm.icu.impl.ICUData, .ICUResourceBundle, .StandardPlural, .UResource, com.ibm.icu.text.CompactDecimalFormat.CompactStyle, .PluralRules, com.ibm.icu.util.ICUException, .ULocale, .UResourceBundle

Datatype for compact notation data. Includes logic for data loading.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static enum

Field Summary

Modifier and TypeField and Description
private static final int
private boolean
private byte
private final byte[]
private final String[]
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static final int
countZeros(String patternString)

private static final int
getIndex(int magnitude, StandardPlural plural)

public int
getMultiplier(int
The power of ten of the input number.
magnitude
)

Implements com.ibm.icu.impl.number.MultiplierProducer.getMultiplier.

Maps a magnitude to a multiplier in powers of ten.
public String
getPattern(int magnitude, PluralRules rules, DecimalQuantity dq)

Deprecated as a consequence of DecimalQuantity being deprecated.
private static void
getResourceBundleKey(String nsName, CompactDecimalFormat.CompactStyle compactStyle, CompactData.CompactType compactType, StringBuilder sb)

Produces a string like "NumberElements/latn/patternsShort/decimalFormat".

public void
public void
populate(ULocale locale, String nsName, CompactDecimalFormat.CompactStyle compactStyle, CompactData.CompactType compactType)

public void
populate(Map<String, Map<String, String>> powersToPluralsToPatterns)

Java-only method used by CLDR tooling.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMPACT_MAX_DIGITSback to summary
private static final int COMPACT_MAX_DIGITS
isEmptyback to summary
private boolean isEmpty
largestMagnitudeback to summary
private byte largestMagnitude
multipliersback to summary
private final byte[] multipliers
patternsback to summary
private final String[] patterns
USE_FALLBACKback to summary
private static final String USE_FALLBACK

Constructor Detail

CompactDataback to summary
public CompactData()

Method Detail

countZerosback to summary
private static final int countZeros(String patternString)
getIndexback to summary
private static final int getIndex(int magnitude, StandardPlural plural)
getMultiplierback to summary
public int getMultiplier(int magnitude)

Implements com.ibm.icu.impl.number.MultiplierProducer.getMultiplier.

Doc from com.ibm.icu.impl.number.MultiplierProducer.getMultiplier.

Maps a magnitude to a multiplier in powers of ten. For example, in compact notation in English, a magnitude of 5 (e.g., 100,000) should return a multiplier of -3, since the number is displayed in thousands.

Parameters
magnitude:int

The power of ten of the input number.

Returns:int

The shift in powers of ten.

Annotations
@Override
getPatternback to summary
public String getPattern(int magnitude, PluralRules rules, DecimalQuantity dq)

Deprecated

as a consequence of DecimalQuantity being deprecated. See corresponding docs for further information.

getResourceBundleKeyback to summary
private static void getResourceBundleKey(String nsName, CompactDecimalFormat.CompactStyle compactStyle, CompactData.CompactType compactType, StringBuilder sb)

Produces a string like "NumberElements/latn/patternsShort/decimalFormat".

getUniquePatternsback to summary
public void getUniquePatterns(Set<String> output)
populateback to summary
public void populate(ULocale locale, String nsName, CompactDecimalFormat.CompactStyle compactStyle, CompactData.CompactType compactType)
populateback to summary
public void populate(Map<String, Map<String, String>> powersToPluralsToPatterns)

Java-only method used by CLDR tooling.

com.ibm.icu.impl.number back to summary

private final Class CompactData.CompactDataSink

extends Sink
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv CompactData

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
put(UResource.Key
Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.
key
,
UResource.Value
Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.
value
,
boolean
true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.
isRoot
)

Implements abstract com.ibm.icu.impl.UResource.Sink.put.

Called once for each bundle (child-parent-...-root).

Field Detail

databack to summary
pack-priv CompactData data

Constructor Detail

CompactDataSinkback to summary
public CompactDataSink(CompactData data)

Method Detail

putback to summary
public void put(UResource.Key key, UResource.Value value, boolean isRoot)

Implements abstract com.ibm.icu.impl.UResource.Sink.put.

Doc from com.ibm.icu.impl.UResource.Sink.put.

Called once for each bundle (child-parent-...-root). The value is normally an array or table resource, and implementations of this method normally iterate over the tree of resource items stored there.

Parameters
key:UResource.Key

Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.

value:UResource.Value

Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.

isRoot:boolean

true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.

Annotations
@Override
com.ibm.icu.impl.number back to summary

public final Enum CompactData.CompactType

extends Enum<CompactData.CompactType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final CompactData.CompactType
public static final CompactData.CompactType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CompactData.CompactType
public static CompactData.CompactType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CURRENCYback to summary
public static final CompactData.CompactType CURRENCY
DECIMALback to summary
public static final CompactData.CompactType DECIMAL

Constructor Detail

CompactTypeback to summary
private CompactType()

Method Detail

valueOfback to summary
public static CompactData.CompactType valueOf(String name)
valuesback to summary
public static CompactData.CompactType[] values()