Modifier that wraps a decimal format pattern. It applies the pattern's affixes
in Modifier#apply.
In addition to being a Modifier, this class contains the business logic for substituting the correct locale symbols into the affixes of the decimal format pattern.
In order to use this class, create a new instance and call the following four setters:
setPatternInfo, setPatternAttributes, setSymbols, and
setNumberProperties. After calling these four setters, the instance will be ready for use as
a Modifier.
This is a MUTABLE, NON-THREAD-SAFE class designed for performance. Do NOT save references to this or
attempt to use it from multiple threads! Instead, you can obtain a safe, immutable decimal format
pattern modifier by calling MutablePatternModifier#createImmutable, in effect treating this
instance as a builder for the immutable variant.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv Currency | |
| pack-priv StringBuilder | |
| pack-priv NumberFormat. | |
| pack-priv final boolean | |
| pack-priv MicroPropsGenerator | |
| pack-priv AffixPatternProvider | |
| pack-priv boolean | |
| pack-priv StandardPlural | |
| pack-priv PluralRules | |
| pack-priv NumberFormatter. | |
| pack-priv Modifier. | |
| pack-priv DecimalFormatSymbols | |
| pack-priv NumberFormatter. |
| Access | Constructor and Description |
|---|---|
| public | MutablePatternModifier(boolean
Whether the modifier should be considered strong. For more information, see
isStrong)Modifier#isStrong(). Most of the time, decimal format pattern modifiers should
be considered as non-strong.
|
| Modifier and Type | Method and Description |
|---|---|
| public MicroPropsGenerator | |
| public int | apply(FormattedStringBuilder
The string builder to which to apply this modifier. output, int The left index of the string within the builder. Equal to 0 when only one number is
being formatted. leftIndex, int The right index of the string within the string builder. Equal to length when only one
number is being formatted. rightIndex)Implements com. |
| public boolean | containsField(Format.
Implements com. |
| private ConstantMultiFieldModifier | Returns: The constant modifier object.A working FormattedStringBuilder object; passed from the outside to prevent the need to
create many new instances if this method is called in a loop. a, FormattedStringBuilder Another working FormattedStringBuilder object. b)Uses the current properties to create a single |
| public MutablePatternModifier. | Returns: An immutable that supports both positive and negative numbers.Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable and can be saved for future use. |
| public int | getCodePointCount()
Implements com. |
| public String | getCurrencySymbolForUnitWidth()
Returns the currency symbol for the unit width specified in setSymbols() |
| public Modifier. | getParameters()
Implements com. |
| public int | getPrefixLength()
Implements com. |
| public CharSequence | getSymbol(int type)
Implements com. |
| private int | |
| private int | |
| public boolean | |
| public boolean | needsPlurals()
Returns true if the pattern represented by this MurkyModifier requires a plural keyword in order to localize. |
| private void | prepareAffix(boolean
true to prepare the prefix; false to prepare the suffix. isPrefix)Pre-processes the prefix or suffix into the currentAffix field, creating and mutating that field if necessary. |
| public MicroProps | processQuantity(DecimalQuantity
The quantity for consideration and optional mutation. fq)Implements com.
Deprecated
as a consequence of
Considers the given DecimalQuantity being deprecated.
DecimalQuantity, optionally mutates it, and returns a
MicroProps.
|
| public boolean | semanticallyEquivalent(Modifier other)
Implements com. |
| public void | setNumberProperties(Modifier.
-1 if negative; +1 if positive; or 0 if zero. signum,The plural form of the number, required only if the pattern contains the triple
currency sign, "¤¤¤" (and as indicated by plural)needsPlurals()).Sets attributes of the current number being processed. |
| public void | setPatternAttributes(NumberFormatter.
Whether to force a plus sign on positive numbers. signDisplay,Whether to substitute the percent sign in the pattern with a permille sign. perMille, boolean Whether to prepend approximately to the sign approximately)Sets attributes that imply changes to the literal interpretation of the pattern string affixes. |
| public void | setPatternInfo(AffixPatternProvider patternInfo, NumberFormat.
Which field to use for literal characters in the pattern. fieldSets a reference to the parsed decimal format pattern, usually obtained from
|
| public void | setSymbols(DecimalFormatSymbols
The desired instance of DecimalFormatSymbols. symbols, Currency The currency to be used when substituting currency values into the affixes. currency, NumberFormatter.The width used to render currencies. unitWidth,Required if the triple currency sign, "¤¤¤", appears in the pattern, which can be
determined from the convenience method rules)needsPlurals().Sets locale-specific details that affect the symbols substituted into the pattern string affixes. |
| approximately | back to summary |
|---|---|
| pack-priv boolean approximately | |
| currency | back to summary |
|---|---|
| pack-priv Currency currency | |
| currentAffix | back to summary |
|---|---|
| pack-priv StringBuilder currentAffix | |
| field | back to summary |
|---|---|
| pack-priv NumberFormat. | |
| isStrong | back to summary |
|---|---|
| pack-priv final boolean isStrong | |
| parent | back to summary |
|---|---|
| pack-priv MicroPropsGenerator parent | |
| patternInfo | back to summary |
|---|---|
| pack-priv AffixPatternProvider patternInfo | |
| perMilleReplacesPercent | back to summary |
|---|---|
| pack-priv boolean perMilleReplacesPercent | |
| plural | back to summary |
|---|---|
| pack-priv StandardPlural plural | |
| rules | back to summary |
|---|---|
| pack-priv PluralRules rules | |
| signDisplay | back to summary |
|---|---|
| pack-priv NumberFormatter. | |
| signum | back to summary |
|---|---|
| pack-priv Modifier. | |
| symbols | back to summary |
|---|---|
| pack-priv DecimalFormatSymbols symbols | |
| unitWidth | back to summary |
|---|---|
| pack-priv NumberFormatter. | |
| MutablePatternModifier | back to summary |
|---|---|
public MutablePatternModifier(boolean isStrong)
| |
| addToChain | back to summary |
|---|---|
| public MicroPropsGenerator addToChain(MicroPropsGenerator parent) Used by the unsafe code path. | |
| apply | back to summary |
|---|---|
| public int apply(FormattedStringBuilder output, int leftIndex, int rightIndex) Implements com. Doc from com. Apply this Modifier to the string builder.
| |
| containsField | back to summary |
|---|---|
| public boolean containsField(Format. Implements com. Doc from com. Whether the modifier contains at least one occurrence of the given field.
| |
| createConstantModifier | back to summary |
|---|---|
| private ConstantMultiFieldModifier createConstantModifier(FormattedStringBuilder a, FormattedStringBuilder b) Uses the current properties to create a single
| |
| createImmutable | back to summary |
|---|---|
| public MutablePatternModifier. Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable and can be saved for future use. The number properties in the current instance are mutated; all other properties are left untouched. The resulting modifier cannot be used in a QuantityChain.
| |
| getCodePointCount | back to summary |
|---|---|
| public int getCodePointCount() Implements com. Doc from com. Returns the number of code points in the modifier, prefix plus suffix.
| |
| getCurrencySymbolForUnitWidth | back to summary |
|---|---|
| public String getCurrencySymbolForUnitWidth() Returns the currency symbol for the unit width specified in setSymbols() | |
| getParameters | back to summary |
|---|---|
| public Modifier. Implements com. Doc from com. Gets a set of "parameters" for this Modifier.
| |
| getPrefixLength | back to summary |
|---|---|
| public int getPrefixLength() Implements com. Doc from com. Gets the length of the prefix. This information can be used in combination with
| |
| getSymbol | back to summary |
|---|---|
| public CharSequence getSymbol(int type) Implements com. Returns the string that substitutes a given symbol type in a pattern.
| |
| insertPrefix | back to summary |
|---|---|
| private int insertPrefix(FormattedStringBuilder sb, int position) | |
| insertSuffix | back to summary |
|---|---|
| private int insertSuffix(FormattedStringBuilder sb, int position) | |
| isStrong | back to summary |
|---|---|
| public boolean isStrong() Implements com. Doc from com. Whether this modifier is strong. If a modifier is strong, it should always be applied immediately and not allowed to bubble up. With regard to padding, strong modifiers are considered to be on the inside of the prefix and suffix.
| |
| needsPlurals | back to summary |
|---|---|
| public boolean needsPlurals() Returns true if the pattern represented by this MurkyModifier requires a plural keyword in order to localize. This is currently true only if there is a currency long name placeholder in the pattern ("¤¤¤"). | |
| prepareAffix | back to summary |
|---|---|
| private void prepareAffix(boolean isPrefix) Pre-processes the prefix or suffix into the currentAffix field, creating and mutating that field
if necessary. Calls down to
| |
| processQuantity | back to summary |
|---|---|
| public MicroProps processQuantity(DecimalQuantity fq) Implements com. Doc from com. Deprecated as a consequence of Considers the given
| |
| semanticallyEquivalent | back to summary |
|---|---|
| public boolean semanticallyEquivalent(Modifier other) Implements com. Doc from com. Returns whether this Modifier is *semantically equivalent* to the other Modifier; in many cases, this is the same as equal, but parameters should be ignored.
| |
| setNumberProperties | back to summary |
|---|---|
| public void setNumberProperties(Modifier. Sets attributes of the current number being processed.
| |
| setPatternAttributes | back to summary |
|---|---|
| public void setPatternAttributes(NumberFormatter. Sets attributes that imply changes to the literal interpretation of the pattern string affixes.
| |
| setPatternInfo | back to summary |
|---|---|
| public void setPatternInfo(AffixPatternProvider patternInfo, NumberFormat. Sets a reference to the parsed decimal format pattern, usually obtained from
| |
| setSymbols | back to summary |
|---|---|
| public void setSymbols(DecimalFormatSymbols symbols, Currency currency, NumberFormatter. Sets locale-specific details that affect the symbols substituted into the pattern string affixes.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv MicroPropsGenerator | |
| pack-priv final AdoptingModifierStore | |
| pack-priv final PluralRules |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public MutablePatternModifier. | |
| public void | applyToMicros(MicroProps micros, DecimalQuantity quantity)
Deprecated
as a consequence of
DecimalQuantity being deprecated.
|
| public MicroProps | processQuantity(DecimalQuantity
The quantity for consideration and optional mutation. quantity)Implements com.
Deprecated
as a consequence of
Considers the given DecimalQuantity being deprecated.
DecimalQuantity, optionally mutates it, and returns a
MicroProps.
|
| parent | back to summary |
|---|---|
| pack-priv MicroPropsGenerator parent | |
| pm | back to summary |
|---|---|
| pack-priv final AdoptingModifierStore pm | |
| rules | back to summary |
|---|---|
| pack-priv final PluralRules rules | |
| ImmutablePatternModifier | back to summary |
|---|---|
| pack-priv ImmutablePatternModifier(AdoptingModifierStore pm, PluralRules rules) | |
| addToChain | back to summary |
|---|---|
| public MutablePatternModifier. | |
| applyToMicros | back to summary |
|---|---|
| public void applyToMicros(MicroProps micros, DecimalQuantity quantity)
Deprecated as a consequence of | |
| processQuantity | back to summary |
|---|---|
| public MicroProps processQuantity(DecimalQuantity quantity) Implements com. Doc from com. Deprecated as a consequence of Considers the given
| |