Top Description Fields Constructors Methods
com.ibm.icu.impl.number

public Class ConstantMultiFieldModifier

extends Object
implements Modifier
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.number.Modifier
Known Direct Subclasses
com.ibm.icu.impl.number.CurrencySpacingEnabledModifier
Imports
java.text.Format.Field, java.util.Arrays, com.ibm.icu.impl.FormattedStringBuilder

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).

Field Summary

Modifier and TypeField and Description
private final boolean
private final Modifier.Parameters
protected final char[]
protected final Object[]
private final boolean
protected final char[]
protected final Object[]

Constructor Summary

AccessConstructor and Description
public
ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong)

public
ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters)

Method Summary

Modifier and TypeMethod and Description
public int
apply(FormattedStringBuilder
The string builder to which to apply this modifier.
output
,
int
The left index of the string within the builder. Equal to 0 when only one number is being formatted.
leftIndex
,
int
The right index of the string within the string builder. Equal to length when only one number is being formatted.
rightIndex
)

Implements com.ibm.icu.impl.number.Modifier.apply.

Apply this Modifier to the string builder.
public boolean
containsField(Format.Field field)

Implements com.ibm.icu.impl.number.Modifier.containsField.

Whether the modifier contains at least one occurrence of the given field.
public int
getCodePointCount()

Implements com.ibm.icu.impl.number.Modifier.getCodePointCount.

Returns the number of code points in the modifier, prefix plus suffix.
public Modifier.Parameters
getParameters()

Implements com.ibm.icu.impl.number.Modifier.getParameters.

Gets a set of "parameters" for this Modifier.
public int
getPrefixLength()

Implements com.ibm.icu.impl.number.Modifier.getPrefixLength.

Gets the length of the prefix.
public boolean
isStrong()

Implements com.ibm.icu.impl.number.Modifier.isStrong.

Whether this modifier is strong.
public boolean
semanticallyEquivalent(Modifier other)

Implements com.ibm.icu.impl.number.Modifier.semanticallyEquivalent.

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.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

overwriteback to summary
private final boolean overwrite
parametersback to summary
private final Modifier.Parameters parameters
prefixCharsback to summary
protected final char[] prefixChars
prefixFieldsback to summary
protected final Object[] prefixFields
strongback to summary
private final boolean strong
suffixCharsback to summary
protected final char[] suffixChars
suffixFieldsback to summary
protected final Object[] suffixFields

Constructor Detail

ConstantMultiFieldModifierback to summary
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong)
ConstantMultiFieldModifierback to summary
public ConstantMultiFieldModifier(FormattedStringBuilder prefix, FormattedStringBuilder suffix, boolean overwrite, boolean strong, Modifier.Parameters parameters)

Method Detail

applyback to summary
public int apply(FormattedStringBuilder output, int leftIndex, int rightIndex)

Implements com.ibm.icu.impl.number.Modifier.apply.

Doc from com.ibm.icu.impl.number.Modifier.apply.

Apply this Modifier to the string builder.

Parameters
output:FormattedStringBuilder

The string builder to which to apply this modifier.

leftIndex:int

The left index of the string within the builder. Equal to 0 when only one number is being formatted.

rightIndex:int

The right index of the string within the string builder. Equal to length when only one number is being formatted.

Returns:int

The number of characters (UTF-16 code units) that were added to the string builder.

Annotations
@Override
containsFieldback to summary
public boolean containsField(Format.Field field)

Implements com.ibm.icu.impl.number.Modifier.containsField.

Doc from com.ibm.icu.impl.number.Modifier.containsField.

Whether the modifier contains at least one occurrence of the given field.

Annotations
@Override
getCodePointCountback to summary
public int getCodePointCount()

Implements com.ibm.icu.impl.number.Modifier.getCodePointCount.

Doc from com.ibm.icu.impl.number.Modifier.getCodePointCount.

Returns the number of code points in the modifier, prefix plus suffix.

Annotations
@Override
getParametersback to summary
public Modifier.Parameters getParameters()

Implements com.ibm.icu.impl.number.Modifier.getParameters.

Doc from com.ibm.icu.impl.number.Modifier.getParameters.

Gets a set of "parameters" for this Modifier.

Annotations
@Override
getPrefixLengthback to summary
public int getPrefixLength()

Implements com.ibm.icu.impl.number.Modifier.getPrefixLength.

Doc from com.ibm.icu.impl.number.Modifier.getPrefixLength.

Gets the length of the prefix. This information can be used in combination with apply to extract the prefix and suffix strings.

Returns:int

The number of characters (UTF-16 code units) in the prefix.

Annotations
@Override
isStrongback to summary
public boolean isStrong()

Implements com.ibm.icu.impl.number.Modifier.isStrong.

Doc from com.ibm.icu.impl.number.Modifier.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:boolean

Whether the modifier is strong.

Annotations
@Override
semanticallyEquivalentback to summary
public boolean semanticallyEquivalent(Modifier other)

Implements com.ibm.icu.impl.number.Modifier.semanticallyEquivalent.

Doc from com.ibm.icu.impl.number.Modifier.semanticallyEquivalent.

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.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override