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

public Class ConstantAffixModifier

extends Object
implements Modifier
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.number.Modifier
Imports
java.text.Format.Field, com.ibm.icu.impl.FormattedStringBuilder

The canonical implementation of Modifier, containing a prefix and suffix string.

Field Summary

Modifier and TypeField and Description
public static final ConstantAffixModifier
private final Format.Field
private final String
private final boolean
private final String

Constructor Summary

AccessConstructor and Description
public
ConstantAffixModifier(String
The prefix string.
prefix
,
String
The suffix string.
suffix
,
Format.Field
The field type to be associated with this modifier. Can be null.
field
,
boolean
Whether this modifier should be strongly applied.
strong
)

Constructs an instance with the given strings.

public
ConstantAffixModifier()

Constructs a new instance with an empty prefix, suffix, and field.

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

EMPTYback to summary
public static final ConstantAffixModifier EMPTY
fieldback to summary
private final Format.Field field
prefixback to summary
private final String prefix
strongback to summary
private final boolean strong
suffixback to summary
private final String suffix

Constructor Detail

ConstantAffixModifierback to summary
public ConstantAffixModifier(String prefix, String suffix, Format.Field field, boolean strong)

Constructs an instance with the given strings.

The arguments need to be Strings, not CharSequences, because Strings are immutable but CharSequences are not.

Parameters
prefix:String

The prefix string.

suffix:String

The suffix string.

field:Format.Field

The field type to be associated with this modifier. Can be null.

strong:boolean

Whether this modifier should be strongly applied.

See Also
Field
ConstantAffixModifierback to summary
public ConstantAffixModifier()

Constructs a new instance with an empty prefix, suffix, and field.

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