Class ConstantMultiFieldModifier
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.number.ConstantMultiFieldModifier
- All Implemented Interfaces:
Modifier
- Direct Known Subclasses:
CurrencySpacingEnabledModifier
An implementation of
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).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.graalvm.shadowed.com.ibm.icu.impl.number.Modifier
Modifier.Parameters, Modifier.Signum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong) ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters) -
Method Summary
Modifier and TypeMethodDescriptionintapply(FormattedStringBuilder output, int leftIndex, int rightIndex) Apply this Modifier to the string builder.booleancontainsField(Format.Field field) Whether the modifier contains at least one occurrence of the given field.intReturns the number of code points in the modifier, prefix plus suffix.Gets a set of "parameters" for this Modifier.intGets the length of the prefix.booleanisStrong()Whether this modifier is strong.booleansemanticallyEquivalent(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.toString()
-
Field Details
-
prefixChars
protected final char[] prefixChars -
suffixChars
protected final char[] suffixChars -
prefixFields
-
suffixFields
-
-
Constructor Details
-
ConstantMultiFieldModifier
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong) -
ConstantMultiFieldModifier
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters)
-
-
Method Details
-
apply
Description copied from interface:ModifierApply this Modifier to the string builder.- Specified by:
applyin interfaceModifier- 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
public int getPrefixLength()Description copied from interface:ModifierGets the length of the prefix. This information can be used in combination withModifier.apply(org.graalvm.shadowed.com.ibm.icu.impl.FormattedStringBuilder, int, int)to extract the prefix and suffix strings.- Specified by:
getPrefixLengthin interfaceModifier- Returns:
- The number of characters (UTF-16 code units) in the prefix.
-
getCodePointCount
public int getCodePointCount()Description copied from interface:ModifierReturns the number of code points in the modifier, prefix plus suffix.- Specified by:
getCodePointCountin interfaceModifier
-
isStrong
public boolean isStrong()Description copied from interface:ModifierWhether 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. -
containsField
Description copied from interface:ModifierWhether the modifier contains at least one occurrence of the given field.- Specified by:
containsFieldin interfaceModifier
-
getParameters
Description copied from interface:ModifierGets a set of "parameters" for this Modifier.- Specified by:
getParametersin interfaceModifier
-
semanticallyEquivalent
Description copied from interface:ModifierReturns whether this Modifier is *semantically equivalent* to the other Modifier; in many cases, this is the same as equal, but parameters should be ignored.- Specified by:
semanticallyEquivalentin interfaceModifier
-
toString
-