Modifier.Parameters, Modifier.Signum| Modifier and Type | Field and Description |
|---|---|
static ConstantAffixModifier |
EMPTY |
| Constructor and Description |
|---|
ConstantAffixModifier()
Constructs a new instance with an empty prefix, suffix, and field.
|
ConstantAffixModifier(String prefix,
String suffix,
Format.Field field,
boolean strong)
Constructs an instance with the given strings.
|
| Modifier and Type | Method and Description |
|---|---|
int |
apply(FormattedStringBuilder output,
int leftIndex,
int rightIndex)
Apply this Modifier to the string builder.
|
boolean |
containsField(Format.Field field)
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.
|
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.
|
String |
toString() |
public static final ConstantAffixModifier EMPTY
public ConstantAffixModifier(String prefix, String suffix, Format.Field field, boolean strong)
The arguments need to be Strings, not CharSequences, because Strings are immutable but CharSequences are not.
prefix - The prefix string.suffix - The suffix string.field - The field type to be associated with this modifier. Can be null.strong - Whether this modifier should be strongly applied.Format.Fieldpublic ConstantAffixModifier()
public int apply(FormattedStringBuilder output, int leftIndex, int rightIndex)
Modifierapply in interface Modifieroutput - 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.public int getPrefixLength()
ModifierModifier.apply(org.graalvm.shadowed.com.ibm.icu.impl.FormattedStringBuilder, int, int) to
extract the prefix and suffix strings.getPrefixLength in interface Modifierpublic int getCodePointCount()
ModifiergetCodePointCount in interface Modifierpublic boolean isStrong()
Modifierpublic boolean containsField(Format.Field field)
ModifiercontainsField in interface Modifierpublic Modifier.Parameters getParameters()
ModifiergetParameters in interface Modifierpublic boolean semanticallyEquivalent(Modifier other)
ModifiersemanticallyEquivalent in interface Modifier