OLD | NEW |
1 // © 2017 and later: Unicode, Inc. and others. | 1 // © 2017 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html#License | 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
3 package com.ibm.icu.impl.number; | 3 package com.ibm.icu.impl.number; |
4 | 4 |
5 /** | 5 /** |
6 * A Modifier is an object that can be passed through the formatting pipeline un
til it is finally applied to the string | 6 * A Modifier is an object that can be passed through the formatting pipeline un
til it is finally applied |
7 * builder. A Modifier usually contains a prefix and a suffix that are applied,
but it could contain something else, | 7 * to the string builder. A Modifier usually contains a prefix and a suffix that
are applied, but it |
8 * like a {@link com.ibm.icu.text.SimpleFormatter} pattern. | 8 * could contain something else, like a {@link com.ibm.icu.text.SimpleFormatter}
pattern. |
9 * | 9 * |
10 * A Modifier is usually immutable, except in cases such as {@link MutablePatter
nModifier}, which are mutable for performance | 10 * A Modifier is usually immutable, except in cases such as {@link MutablePatter
nModifier}, which are |
11 * reasons. | 11 * mutable for performance reasons. |
12 */ | 12 */ |
13 public interface Modifier { | 13 public interface Modifier { |
14 | 14 |
15 /** | 15 /** |
16 * Apply this Modifier to the string builder. | 16 * Apply this Modifier to the string builder. |
17 * | 17 * |
18 * @param output | 18 * @param output |
19 * The string builder to which to apply this modifier. | 19 * The string builder to which to apply this modifier. |
20 * @param leftIndex | 20 * @param leftIndex |
21 * The left index of the string within the builder. Equal to 0 wh
en only one number is being formatted. | 21 * The left index of the string within the builder. Equal to 0 wh
en only one number is |
| 22 * being formatted. |
22 * @param rightIndex | 23 * @param rightIndex |
23 * The right index of the string within the string builder. Equal
to length when only one number is being | 24 * The right index of the string within the string builder. Equal
to length when only one |
24 * formatted. | 25 * number is being formatted. |
25 * @return The number of characters (UTF-16 code units) that were added to t
he string builder. | 26 * @return The number of characters (UTF-16 code units) that were added to t
he string builder. |
26 */ | 27 */ |
27 public int apply(NumberStringBuilder output, int leftIndex, int rightIndex); | 28 public int apply(NumberStringBuilder output, int leftIndex, int rightIndex); |
28 | 29 |
29 /** | 30 /** |
30 * Gets the length of the prefix. This information can be used in combinatio
n with {@link #apply} to extract the | 31 * Gets the length of the prefix. This information can be used in combinatio
n with {@link #apply} to |
31 * prefix and suffix strings. | 32 * extract the prefix and suffix strings. |
32 * | 33 * |
33 * @return The number of characters (UTF-16 code units) in the prefix. | 34 * @return The number of characters (UTF-16 code units) in the prefix. |
34 */ | 35 */ |
35 public int getPrefixLength(); | 36 public int getPrefixLength(); |
36 | 37 |
37 /** | 38 /** |
38 * Returns the number of code points in the modifier, prefix plus suffix. | 39 * Returns the number of code points in the modifier, prefix plus suffix. |
39 */ | 40 */ |
40 public int getCodePointCount(); | 41 public int getCodePointCount(); |
41 | 42 |
42 /** | 43 /** |
43 * Whether this modifier is strong. If a modifier is strong, it should alway
s be applied immediately and not allowed | 44 * Whether this modifier is strong. If a modifier is strong, it should alway
s be applied immediately |
44 * to bubble up. With regard to padding, strong modifiers are considered to
be on the inside of the prefix and | 45 * and not allowed to bubble up. With regard to padding, strong modifiers ar
e considered to be on the |
45 * suffix. | 46 * inside of the prefix and suffix. |
46 * | 47 * |
47 * @return Whether the modifier is strong. | 48 * @return Whether the modifier is strong. |
48 */ | 49 */ |
49 public boolean isStrong(); | 50 public boolean isStrong(); |
50 } | 51 } |
OLD | NEW |