Package com.ibm.icu.impl.number
Interface Modifier
- All Known Implementing Classes:
ConstantAffixModifier
,ConstantMultiFieldModifier
,CurrencySpacingEnabledModifier
,MutablePatternModifier
,ScientificNotation.ScientificHandler
,ScientificNotation.ScientificModifier
,SimpleModifier
public interface Modifier
A Modifier is an object that can be passed through the formatting pipeline until it is finally applied
to the string builder. A Modifier usually contains a prefix and a suffix that are applied, but it
could contain something else, like a
SimpleFormatter
pattern.
A Modifier is usually immutable, except in cases such as MutablePatternModifier
, which are
mutable for performance reasons.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
A fill-in for getParameters().static enum
-
Method Summary
Modifier and TypeMethodDescriptionint
apply
(FormattedStringBuilder output, int leftIndex, int rightIndex) Apply this Modifier to the string builder.boolean
containsField
(Format.Field currency) Whether the modifier contains at least one occurrence of the given field.int
Returns the number of code points in the modifier, prefix plus suffix.Gets a set of "parameters" for this Modifier.int
Gets the length of the prefix.boolean
isStrong()
Whether this modifier is strong.boolean
semanticallyEquivalent
(Modifier other) 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.
-
Method Details
-
apply
Apply this Modifier to the string builder.- Parameters:
output
- The string builder to which to apply this modifier.leftIndex
- The left index of the string within the builder. Equal to 0 when only one number is being formatted.rightIndex
- The right index of the string within the string builder. Equal to length when only one number is being formatted.- Returns:
- The number of characters (UTF-16 code units) that were added to the string builder.
-
getPrefixLength
int getPrefixLength()Gets the length of the prefix. This information can be used in combination withapply(com.ibm.icu.impl.FormattedStringBuilder, int, int)
to extract the prefix and suffix strings.- Returns:
- The number of characters (UTF-16 code units) in the prefix.
-
getCodePointCount
int getCodePointCount()Returns the number of code points in the modifier, prefix plus suffix. -
isStrong
boolean isStrong()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.- Returns:
- Whether the modifier is strong.
-
containsField
Whether the modifier contains at least one occurrence of the given field. -
getParameters
Modifier.Parameters getParameters()Gets a set of "parameters" for this Modifier. -
semanticallyEquivalent
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.
-