public class ConstantMultiFieldModifier extends Object implements Modifier
Modifier that allows for multiple types of fields in the same modifier.
Constructed based on the contents of two FormattedStringBuilder instances (one for the prefix,
one for the suffix).Modifier.Parameters, Modifier.Signum| Modifier and Type | Field and Description |
|---|---|
protected char[] |
prefixChars |
protected Object[] |
prefixFields |
protected char[] |
suffixChars |
protected Object[] |
suffixFields |
| Constructor and Description |
|---|
ConstantMultiFieldModifier(FormattedStringBuilder prefix,
FormattedStringBuilder suffix,
boolean overwrite,
boolean strong) |
ConstantMultiFieldModifier(FormattedStringBuilder prefix,
FormattedStringBuilder suffix,
boolean overwrite,
boolean strong,
Modifier.Parameters parameters) |
| 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() |
protected final char[] prefixChars
protected final char[] suffixChars
protected final Object[] prefixFields
protected final Object[] suffixFields
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong)
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters)
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