Package com.ibm.icu.impl.number
Class ConstantMultiFieldModifier
- java.lang.Object
-
- com.ibm.icu.impl.number.ConstantMultiFieldModifier
-
- All Implemented Interfaces:
Modifier
- Direct Known Subclasses:
CurrencySpacingEnabledModifier
public class ConstantMultiFieldModifier extends java.lang.Object implements Modifier
An implementation ofModifier
that allows for multiple types of fields in the same modifier. Constructed based on the contents of twoFormattedStringBuilder
instances (one for the prefix, one for the suffix).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.ibm.icu.impl.number.Modifier
Modifier.Parameters, Modifier.Signum
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
overwrite
private Modifier.Parameters
parameters
protected char[]
prefixChars
protected java.lang.Object[]
prefixFields
private boolean
strong
protected char[]
suffixChars
protected java.lang.Object[]
suffixFields
-
Constructor Summary
Constructors Constructor Description ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong)
ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters)
-
Method Summary
All Methods Instance Methods Concrete 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 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
strictEquals(Modifier other)
Returns whether this Modifier equals another Modifier.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.ibm.icu.impl.number.Modifier
semanticallyEquivalent
-
-
-
-
Field Detail
-
prefixChars
protected final char[] prefixChars
-
suffixChars
protected final char[] suffixChars
-
prefixFields
protected final java.lang.Object[] prefixFields
-
suffixFields
protected final java.lang.Object[] suffixFields
-
overwrite
private final boolean overwrite
-
strong
private final boolean strong
-
parameters
private final Modifier.Parameters parameters
-
-
Constructor Detail
-
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 Detail
-
apply
public int apply(FormattedStringBuilder output, int leftIndex, int rightIndex)
Description copied from interface:Modifier
Apply this Modifier to the string builder.- Specified by:
apply
in 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:Modifier
Gets the length of the prefix. This information can be used in combination withModifier.apply(com.ibm.icu.impl.FormattedStringBuilder, int, int)
to extract the prefix and suffix strings.- Specified by:
getPrefixLength
in interfaceModifier
- Returns:
- The number of characters (UTF-16 code units) in the prefix.
-
getCodePointCount
public int getCodePointCount()
Description copied from interface:Modifier
Returns the number of code points in the modifier, prefix plus suffix.- Specified by:
getCodePointCount
in interfaceModifier
-
isStrong
public boolean isStrong()
Description copied from interface:Modifier
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.
-
containsField
public boolean containsField(java.text.Format.Field field)
Description copied from interface:Modifier
Whether the modifier contains at least one occurrence of the given field.- Specified by:
containsField
in interfaceModifier
-
getParameters
public Modifier.Parameters getParameters()
Description copied from interface:Modifier
Gets a set of "parameters" for this Modifier.- Specified by:
getParameters
in interfaceModifier
-
strictEquals
public boolean strictEquals(Modifier other)
Description copied from interface:Modifier
Returns whether this Modifier equals another Modifier.- Specified by:
strictEquals
in interfaceModifier
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-