Package com.ibm.icu.impl
Class FormattedValueStringBuilderImpl
java.lang.Object
com.ibm.icu.impl.FormattedValueStringBuilderImpl
Implementation of FormattedValue based on FormattedStringBuilder.
The implementation currently revolves around numbers and number fields.
However, it can be generalized in the future when there is a need.
In C++, this implements FormattedValue. In Java, it is a stateless
collection of static functions to avoid having to use nested objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classstatic classPlaceholder field used for calculating spans. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplySpanRange(FormattedStringBuilder self, UFormat.SpanField spanField, Object value, int start, int end) Upgrade a range of a string to a span field.static intfindSpan(FormattedStringBuilder self, Object value) Finds the index at which a span field begins.private static booleanisIntOrGroup(Object field) private static booleanisNumericField(Object field) private static booleanisTrimmable(Object field) static booleanstatic booleannextPosition(FormattedStringBuilder self, ConstrainedFieldPosition cfpos, Format.Field numericField) Implementation of nextPosition consistent with the contract of FormattedValue.static AttributedCharacterIteratortoCharacterIterator(FormattedStringBuilder self, Format.Field numericField) private static inttrimBack(FormattedStringBuilder self, int limit) private static inttrimFront(FormattedStringBuilder self, int start)
-
Constructor Details
-
FormattedValueStringBuilderImpl
public FormattedValueStringBuilderImpl()
-
-
Method Details
-
findSpan
Finds the index at which a span field begins.- Parameters:
value- The value of the span field to search for.- Returns:
- The index, or -1 if not found.
-
applySpanRange
public static void applySpanRange(FormattedStringBuilder self, UFormat.SpanField spanField, Object value, int start, int end) Upgrade a range of a string to a span field. Similar to appendSpanInfo in ICU4C. -
nextFieldPosition
-
toCharacterIterator
public static AttributedCharacterIterator toCharacterIterator(FormattedStringBuilder self, Format.Field numericField) -
nextPosition
public static boolean nextPosition(FormattedStringBuilder self, ConstrainedFieldPosition cfpos, Format.Field numericField) Implementation of nextPosition consistent with the contract of FormattedValue.- Parameters:
cfpos- The argument passed to the public API.numericField- Optional. If non-null, apply this field to the entire numeric portion of the string.- Returns:
- See FormattedValue#nextPosition.
-
isIntOrGroup
-
isNumericField
-
isTrimmable
-
trimBack
-
trimFront
-