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 aSimpleFormatter
pattern. A Modifier is usually immutable, except in cases such asMutablePatternModifier
, which are mutable for performance reasons.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Modifier.Parameters
A fill-in for getParameters().static class
Modifier.Signum
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
apply(FormattedStringBuilder output, int leftIndex, int rightIndex)
Apply this Modifier to the string builder.boolean
containsField(java.text.Format.Field currency)
Whether the modifier contains at least one occurrence of the given field.int
getCodePointCount()
Returns the number of code points in the modifier, prefix plus suffix.Modifier.Parameters
getParameters()
Gets a set of "parameters" for this Modifier.int
getPrefixLength()
Gets the length of the prefix.boolean
isStrong()
Whether this modifier is strong.default 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.boolean
strictEquals(Modifier other)
Returns whether this Modifier equals another Modifier.
-
-
-
Method Detail
-
apply
int apply(FormattedStringBuilder output, int leftIndex, int rightIndex)
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
boolean containsField(java.text.Format.Field currency)
Whether the modifier contains at least one occurrence of the given field.
-
getParameters
Modifier.Parameters getParameters()
Gets a set of "parameters" for this Modifier.
-
strictEquals
boolean strictEquals(Modifier other)
Returns whether this Modifier equals another Modifier.
-
semanticallyEquivalent
default 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.
-
-