LEFT | RIGHT |
(no file at all) | |
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 import com.ibm.icu.text.NumberFormat.Field; | 5 import com.ibm.icu.text.NumberFormat.Field; |
6 | 6 |
7 /** | 7 /** |
8 * The canonical implementation of {@link Modifier}, containing a prefix and suf
fix string. | 8 * The canonical implementation of {@link Modifier}, containing a prefix and suf
fix string. |
9 */ | 9 */ |
10 public class ConstantAffixModifier implements Modifier { | 10 public class ConstantAffixModifier implements Modifier { |
11 | 11 |
12 // TODO: Avoid making a new instance by default if prefix and suffix are emp
ty | 12 // TODO: Avoid making a new instance by default if prefix and suffix are emp
ty |
13 public static final ConstantAffixModifier EMPTY = new ConstantAffixModifier(
); | 13 public static final ConstantAffixModifier EMPTY = new ConstantAffixModifier(
); |
14 | 14 |
15 private final String prefix; | 15 private final String prefix; |
16 private final String suffix; | 16 private final String suffix; |
17 private final Field field; | 17 private final Field field; |
18 private final boolean strong; | 18 private final boolean strong; |
19 | 19 |
20 /** | 20 /** |
21 * Constructs an instance with the given strings. | 21 * Constructs an instance with the given strings. |
22 * | 22 * |
23 * <p> | 23 * <p> |
24 * The arguments need to be Strings, not CharSequences, because Strings are
immutable but CharSequences are not. | 24 * The arguments need to be Strings, not CharSequences, because Strings are
immutable but |
| 25 * CharSequences are not. |
25 * | 26 * |
26 * @param prefix | 27 * @param prefix |
27 * The prefix string. | 28 * The prefix string. |
28 * @param suffix | 29 * @param suffix |
29 * The suffix string. | 30 * The suffix string. |
30 * @param field | 31 * @param field |
31 * The field type to be associated with this modifier. Can be nul
l. | 32 * The field type to be associated with this modifier. Can be nul
l. |
32 * @param strong | 33 * @param strong |
33 * Whether this modifier should be strongly applied. | 34 * Whether this modifier should be strongly applied. |
34 * @see Field | 35 * @see Field |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 @Override | 72 @Override |
72 public boolean isStrong() { | 73 public boolean isStrong() { |
73 return strong; | 74 return strong; |
74 } | 75 } |
75 | 76 |
76 @Override | 77 @Override |
77 public String toString() { | 78 public String toString() { |
78 return String.format("<ConstantAffixModifier prefix:'%s' suffix:'%s'>",
prefix, suffix); | 79 return String.format("<ConstantAffixModifier prefix:'%s' suffix:'%s'>",
prefix, suffix); |
79 } | 80 } |
80 } | 81 } |
LEFT | RIGHT |