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.impl.StandardPlural; | 5 import com.ibm.icu.impl.StandardPlural; |
6 import com.ibm.icu.impl.number.AffixUtils.SymbolProvider; | 6 import com.ibm.icu.impl.number.AffixUtils.SymbolProvider; |
7 import com.ibm.icu.number.NumberFormatter.SignDisplay; | 7 import com.ibm.icu.number.NumberFormatter.SignDisplay; |
8 import com.ibm.icu.number.NumberFormatter.UnitWidth; | 8 import com.ibm.icu.number.NumberFormatter.UnitWidth; |
9 import com.ibm.icu.text.DecimalFormatSymbols; | 9 import com.ibm.icu.text.DecimalFormatSymbols; |
10 import com.ibm.icu.text.PluralRules; | 10 import com.ibm.icu.text.PluralRules; |
11 import com.ibm.icu.util.Currency; | 11 import com.ibm.icu.util.Currency; |
12 | 12 |
13 /** | 13 /** |
14 * This class is a {@link Modifier} that wraps a decimal format pattern. It appl
ies the pattern's affixes in | 14 * This class is a {@link Modifier} that wraps a decimal format pattern. It appl
ies the pattern's affixes |
15 * {@link Modifier#apply}. | 15 * in {@link Modifier#apply}. |
16 * | 16 * |
17 * <p> | 17 * <p> |
18 * In addition to being a Modifier, this class contains the business logic for s
ubstituting the correct locale symbols | 18 * In addition to being a Modifier, this class contains the business logic for s
ubstituting the correct |
19 * into the affixes of the decimal format pattern. | 19 * locale symbols into the affixes of the decimal format pattern. |
20 * | 20 * |
21 * <p> | 21 * <p> |
22 * In order to use this class, create a new instance and call the following four
setters: {@link #setPatternInfo}, | 22 * In order to use this class, create a new instance and call the following four
setters: |
23 * {@link #setPatternAttributes}, {@link #setSymbols}, and {@link #setNumberProp
erties}. After calling these four | 23 * {@link #setPatternInfo}, {@link #setPatternAttributes}, {@link #setSymbols},
and |
24 * setters, the instance will be ready for use as a Modifier. | 24 * {@link #setNumberProperties}. After calling these four setters, the instance
will be ready for use as |
| 25 * a Modifier. |
25 * | 26 * |
26 * <p> | 27 * <p> |
27 * This is a MUTABLE, NON-THREAD-SAFE class designed for performance. Do NOT sav
e references to this or attempt to use | 28 * This is a MUTABLE, NON-THREAD-SAFE class designed for performance. Do NOT sav
e references to this or |
28 * it from multiple threads! Instead, you can obtain a safe, immutable decimal f
ormat pattern modifier by calling | 29 * attempt to use it from multiple threads! Instead, you can obtain a safe, immu
table decimal format |
29 * {@link MutablePatternModifier#createImmutable}, in effect treating this insta
nce as a builder for the immutable | 30 * pattern modifier by calling {@link MutablePatternModifier#createImmutable}, i
n effect treating this |
30 * variant. | 31 * instance as a builder for the immutable variant. |
31 */ | 32 */ |
32 public class MutablePatternModifier implements Modifier, SymbolProvider, CharSeq
uence, MicroPropsGenerator { | 33 public class MutablePatternModifier |
| 34 implements Modifier, SymbolProvider, CharSequence, MicroPropsGenerator { |
33 | 35 |
34 // Modifier details | 36 // Modifier details |
35 final boolean isStrong; | 37 final boolean isStrong; |
36 | 38 |
37 // Pattern details | 39 // Pattern details |
38 AffixPatternProvider patternInfo; | 40 AffixPatternProvider patternInfo; |
39 SignDisplay signDisplay; | 41 SignDisplay signDisplay; |
40 boolean perMilleReplacesPercent; | 42 boolean perMilleReplacesPercent; |
41 | 43 |
42 // Symbol details | 44 // Symbol details |
(...skipping 12 matching lines...) Expand all Loading... |
55 // Transient CharSequence fields | 57 // Transient CharSequence fields |
56 boolean inCharSequenceMode; | 58 boolean inCharSequenceMode; |
57 int flags; | 59 int flags; |
58 int length; | 60 int length; |
59 boolean prependSign; | 61 boolean prependSign; |
60 boolean plusReplacesMinusSign; | 62 boolean plusReplacesMinusSign; |
61 | 63 |
62 /** | 64 /** |
63 * @param isStrong | 65 * @param isStrong |
64 * Whether the modifier should be considered strong. For more inf
ormation, see | 66 * Whether the modifier should be considered strong. For more inf
ormation, see |
65 * {@link Modifier#isStrong()}. Most of the time, decimal format
pattern modifiers should be considered | 67 * {@link Modifier#isStrong()}. Most of the time, decimal format
pattern modifiers should |
66 * as non-strong. | 68 * be considered as non-strong. |
67 */ | 69 */ |
68 public MutablePatternModifier(boolean isStrong) { | 70 public MutablePatternModifier(boolean isStrong) { |
69 this.isStrong = isStrong; | 71 this.isStrong = isStrong; |
70 } | 72 } |
71 | 73 |
72 /** | 74 /** |
73 * Sets a reference to the parsed decimal format pattern, usually obtained f
rom | 75 * Sets a reference to the parsed decimal format pattern, usually obtained f
rom |
74 * {@link PatternStringParser#parseToPatternInfo(String)}, but any implement
ation of {@link AffixPatternProvider} is | 76 * {@link PatternStringParser#parseToPatternInfo(String)}, but any implement
ation of |
75 * accepted. | 77 * {@link AffixPatternProvider} is accepted. |
76 */ | 78 */ |
77 public void setPatternInfo(AffixPatternProvider patternInfo) { | 79 public void setPatternInfo(AffixPatternProvider patternInfo) { |
78 this.patternInfo = patternInfo; | 80 this.patternInfo = patternInfo; |
79 } | 81 } |
80 | 82 |
81 /** | 83 /** |
82 * Sets attributes that imply changes to the literal interpretation of the p
attern string affixes. | 84 * Sets attributes that imply changes to the literal interpretation of the p
attern string affixes. |
83 * | 85 * |
84 * @param signDisplay | 86 * @param signDisplay |
85 * Whether to force a plus sign on positive numbers. | 87 * Whether to force a plus sign on positive numbers. |
86 * @param perMille | 88 * @param perMille |
87 * Whether to substitute the percent sign in the pattern with a p
ermille sign. | 89 * Whether to substitute the percent sign in the pattern with a p
ermille sign. |
88 */ | 90 */ |
89 public void setPatternAttributes(SignDisplay signDisplay, boolean perMille)
{ | 91 public void setPatternAttributes(SignDisplay signDisplay, boolean perMille)
{ |
90 this.signDisplay = signDisplay; | 92 this.signDisplay = signDisplay; |
91 this.perMilleReplacesPercent = perMille; | 93 this.perMilleReplacesPercent = perMille; |
92 } | 94 } |
93 | 95 |
94 /** | 96 /** |
95 * Sets locale-specific details that affect the symbols substituted into the
pattern string affixes. | 97 * Sets locale-specific details that affect the symbols substituted into the
pattern string affixes. |
96 * | 98 * |
97 * @param symbols | 99 * @param symbols |
98 * The desired instance of DecimalFormatSymbols. | 100 * The desired instance of DecimalFormatSymbols. |
99 * @param currency | 101 * @param currency |
100 * The currency to be used when substituting currency values into
the affixes. | 102 * The currency to be used when substituting currency values into
the affixes. |
101 * @param unitWidth | 103 * @param unitWidth |
102 * The width used to render currencies. | 104 * The width used to render currencies. |
103 * @param rules | 105 * @param rules |
104 * Required if the triple currency sign, "¤¤¤", appears in the pa
ttern, which can be determined from the | 106 * Required if the triple currency sign, "¤¤¤", appears in the pa
ttern, which can be |
105 * convenience method {@link #needsPlurals()}. | 107 * determined from the convenience method {@link #needsPlurals()}
. |
106 */ | 108 */ |
107 public void setSymbols(DecimalFormatSymbols symbols, Currency currency, Unit
Width unitWidth, PluralRules rules) { | 109 public void setSymbols( |
108 assert (rules != null) == needsPlurals(); | 110 DecimalFormatSymbols symbols, |
| 111 Currency currency, |
| 112 UnitWidth unitWidth, |
| 113 PluralRules rules) { |
| 114 //assert (rules != null) == needsPlurals(); |
109 this.symbols = symbols; | 115 this.symbols = symbols; |
110 this.currency = currency; | 116 this.currency = currency; |
111 this.unitWidth = unitWidth; | 117 this.unitWidth = unitWidth; |
112 this.rules = rules; | 118 this.rules = rules; |
113 } | 119 } |
114 | 120 |
115 /** | 121 /** |
116 * Sets attributes of the current number being processed. | 122 * Sets attributes of the current number being processed. |
117 * | 123 * |
118 * @param isNegative | 124 * @param isNegative |
119 * Whether the number is negative. | 125 * Whether the number is negative. |
120 * @param plural | 126 * @param plural |
121 * The plural form of the number, required only if the pattern co
ntains the triple currency sign, "¤¤¤" | 127 * The plural form of the number, required only if the pattern co
ntains the triple |
122 * (and as indicated by {@link #needsPlurals()}). | 128 * currency sign, "¤¤¤" (and as indicated by {@link #needsPlurals
()}). |
123 */ | 129 */ |
124 public void setNumberProperties(boolean isNegative, StandardPlural plural) { | 130 public void setNumberProperties(boolean isNegative, StandardPlural plural) { |
125 assert (plural != null) == needsPlurals(); | 131 assert (plural != null) == needsPlurals(); |
126 this.isNegative = isNegative; | 132 this.isNegative = isNegative; |
127 this.plural = plural; | 133 this.plural = plural; |
128 } | 134 } |
129 | 135 |
130 /** | 136 /** |
131 * Returns true if the pattern represented by this MurkyModifier requires a
plural keyword in order to localize. | 137 * Returns true if the pattern represented by this MurkyModifier requires a
plural keyword in order |
132 * This is currently true only if there is a currency long name placeholder
in the pattern ("¤¤¤"). | 138 * to localize. This is currently true only if there is a currency long name
placeholder in the |
| 139 * pattern ("¤¤¤"). |
133 */ | 140 */ |
134 public boolean needsPlurals() { | 141 public boolean needsPlurals() { |
135 return patternInfo.containsSymbolType(AffixUtils.TYPE_CURRENCY_TRIPLE); | 142 return patternInfo.containsSymbolType(AffixUtils.TYPE_CURRENCY_TRIPLE); |
136 } | 143 } |
137 | 144 |
138 /** | 145 /** |
139 * Creates a new quantity-dependent Modifier that behaves the same as the cu
rrent instance, but which is immutable | 146 * Creates a new quantity-dependent Modifier that behaves the same as the cu
rrent instance, but which |
140 * and can be saved for future use. The number properties in the current ins
tance are mutated; all other properties | 147 * is immutable and can be saved for future use. The number properties in th
e current instance are |
141 * are left untouched. | 148 * mutated; all other properties are left untouched. |
142 * | 149 * |
143 * <p> | 150 * <p> |
144 * The resulting modifier cannot be used in a QuantityChain. | 151 * The resulting modifier cannot be used in a QuantityChain. |
145 * | 152 * |
146 * @return An immutable that supports both positive and negative numbers. | 153 * @return An immutable that supports both positive and negative numbers. |
147 */ | 154 */ |
148 public ImmutablePatternModifier createImmutable() { | 155 public ImmutablePatternModifier createImmutable() { |
149 return createImmutableAndChain(null); | 156 return createImmutableAndChain(null); |
150 } | 157 } |
151 | 158 |
152 /** | 159 /** |
153 * Creates a new quantity-dependent Modifier that behaves the same as the cu
rrent instance, but which is immutable | 160 * Creates a new quantity-dependent Modifier that behaves the same as the cu
rrent instance, but which |
154 * and can be saved for future use. The number properties in the current ins
tance are mutated; all other properties | 161 * is immutable and can be saved for future use. The number properties in th
e current instance are |
155 * are left untouched. | 162 * mutated; all other properties are left untouched. |
156 * | 163 * |
157 * @param parent | 164 * @param parent |
158 * The QuantityChain to which to chain this immutable. | 165 * The QuantityChain to which to chain this immutable. |
159 * @return An immutable that supports both positive and negative numbers. | 166 * @return An immutable that supports both positive and negative numbers. |
160 */ | 167 */ |
161 public ImmutablePatternModifier createImmutableAndChain(MicroPropsGenerator
parent) { | 168 public ImmutablePatternModifier createImmutableAndChain(MicroPropsGenerator
parent) { |
162 NumberStringBuilder a = new NumberStringBuilder(); | 169 NumberStringBuilder a = new NumberStringBuilder(); |
163 NumberStringBuilder b = new NumberStringBuilder(); | 170 NumberStringBuilder b = new NumberStringBuilder(); |
164 if (needsPlurals()) { | 171 if (needsPlurals()) { |
165 // Slower path when we require the plural keyword. | 172 // Slower path when we require the plural keyword. |
(...skipping 11 matching lines...) Expand all Loading... |
177 setNumberProperties(false, null); | 184 setNumberProperties(false, null); |
178 Modifier positive = createConstantModifier(a, b); | 185 Modifier positive = createConstantModifier(a, b); |
179 setNumberProperties(true, null); | 186 setNumberProperties(true, null); |
180 Modifier negative = createConstantModifier(a, b); | 187 Modifier negative = createConstantModifier(a, b); |
181 ParameterizedModifier pm = new ParameterizedModifier(positive, negat
ive); | 188 ParameterizedModifier pm = new ParameterizedModifier(positive, negat
ive); |
182 return new ImmutablePatternModifier(pm, null, parent); | 189 return new ImmutablePatternModifier(pm, null, parent); |
183 } | 190 } |
184 } | 191 } |
185 | 192 |
186 /** | 193 /** |
187 * Uses the current properties to create a single {@link ConstantMultiFieldM
odifier} with currency spacing support | 194 * Uses the current properties to create a single {@link ConstantMultiFieldM
odifier} with currency |
188 * if required. | 195 * spacing support if required. |
189 * | 196 * |
190 * @param a | 197 * @param a |
191 * A working NumberStringBuilder object; passed from the outside
to prevent the need to create many new | 198 * A working NumberStringBuilder object; passed from the outside
to prevent the need to |
192 * instances if this method is called in a loop. | 199 * create many new instances if this method is called in a loop. |
193 * @param b | 200 * @param b |
194 * Another working NumberStringBuilder object. | 201 * Another working NumberStringBuilder object. |
195 * @return The constant modifier object. | 202 * @return The constant modifier object. |
196 */ | 203 */ |
197 private ConstantMultiFieldModifier createConstantModifier(NumberStringBuilde
r a, NumberStringBuilder b) { | 204 private ConstantMultiFieldModifier createConstantModifier( |
| 205 NumberStringBuilder a, |
| 206 NumberStringBuilder b) { |
198 insertPrefix(a.clear(), 0); | 207 insertPrefix(a.clear(), 0); |
199 insertSuffix(b.clear(), 0); | 208 insertSuffix(b.clear(), 0); |
200 if (patternInfo.hasCurrencySign()) { | 209 if (patternInfo.hasCurrencySign()) { |
201 return new CurrencySpacingEnabledModifier(a, b, isStrong, symbols); | 210 return new CurrencySpacingEnabledModifier(a, b, isStrong, symbols); |
202 } else { | 211 } else { |
203 return new ConstantMultiFieldModifier(a, b, isStrong); | 212 return new ConstantMultiFieldModifier(a, b, isStrong); |
204 } | 213 } |
205 } | 214 } |
206 | 215 |
207 public static class ImmutablePatternModifier implements MicroPropsGenerator
{ | 216 public static class ImmutablePatternModifier implements MicroPropsGenerator
{ |
208 final ParameterizedModifier pm; | 217 final ParameterizedModifier pm; |
209 final PluralRules rules; | 218 final PluralRules rules; |
210 final MicroPropsGenerator parent; | 219 final MicroPropsGenerator parent; |
211 | 220 |
212 ImmutablePatternModifier(ParameterizedModifier pm, PluralRules rules, Mi
croPropsGenerator parent) { | 221 ImmutablePatternModifier( |
| 222 ParameterizedModifier pm, |
| 223 PluralRules rules, |
| 224 MicroPropsGenerator parent) { |
213 this.pm = pm; | 225 this.pm = pm; |
214 this.rules = rules; | 226 this.rules = rules; |
215 this.parent = parent; | 227 this.parent = parent; |
216 } | 228 } |
217 | 229 |
218 @Override | 230 @Override |
219 public MicroProps processQuantity(DecimalQuantity quantity) { | 231 public MicroProps processQuantity(DecimalQuantity quantity) { |
220 MicroProps micros = parent.processQuantity(quantity); | 232 MicroProps micros = parent.processQuantity(quantity); |
221 applyToMicros(micros, quantity); | 233 applyToMicros(micros, quantity); |
222 return micros; | 234 return micros; |
(...skipping 30 matching lines...) Expand all Loading... |
253 setNumberProperties(fq.isNegative(), null); | 265 setNumberProperties(fq.isNegative(), null); |
254 } | 266 } |
255 micros.modMiddle = this; | 267 micros.modMiddle = this; |
256 return micros; | 268 return micros; |
257 } | 269 } |
258 | 270 |
259 @Override | 271 @Override |
260 public int apply(NumberStringBuilder output, int leftIndex, int rightIndex)
{ | 272 public int apply(NumberStringBuilder output, int leftIndex, int rightIndex)
{ |
261 int prefixLen = insertPrefix(output, leftIndex); | 273 int prefixLen = insertPrefix(output, leftIndex); |
262 int suffixLen = insertSuffix(output, rightIndex + prefixLen); | 274 int suffixLen = insertSuffix(output, rightIndex + prefixLen); |
263 CurrencySpacingEnabledModifier.applyCurrencySpacing(output, leftIndex, p
refixLen, rightIndex + prefixLen, | 275 CurrencySpacingEnabledModifier.applyCurrencySpacing(output, |
264 suffixLen, symbols); | 276 leftIndex, |
| 277 prefixLen, |
| 278 rightIndex + prefixLen, |
| 279 suffixLen, |
| 280 symbols); |
265 return prefixLen + suffixLen; | 281 return prefixLen + suffixLen; |
266 } | 282 } |
267 | 283 |
268 @Override | 284 @Override |
269 public int getPrefixLength() { | 285 public int getPrefixLength() { |
270 // Enter and exit CharSequence Mode to get the length. | 286 // Enter and exit CharSequence Mode to get the length. |
271 enterCharSequenceMode(true); | 287 enterCharSequenceMode(true); |
272 int result = AffixUtils.unescapedCodePointCount(this, this); // prefix
length | 288 int result = AffixUtils.unescapedCodePointCount(this, this); // prefix l
ength |
273 exitCharSequenceMode(); | 289 exitCharSequenceMode(); |
274 return result; | 290 return result; |
275 } | 291 } |
276 | 292 |
277 @Override | 293 @Override |
278 public int getCodePointCount() { | 294 public int getCodePointCount() { |
279 // Enter and exit CharSequence Mode to get the length. | 295 // Enter and exit CharSequence Mode to get the length. |
280 enterCharSequenceMode(true); | 296 enterCharSequenceMode(true); |
281 int result = AffixUtils.unescapedCodePointCount(this, this); // prefix
length | 297 int result = AffixUtils.unescapedCodePointCount(this, this); // prefix l
ength |
282 exitCharSequenceMode(); | 298 exitCharSequenceMode(); |
283 enterCharSequenceMode(false); | 299 enterCharSequenceMode(false); |
284 result += AffixUtils.unescapedCodePointCount(this, this); // suffix len
gth | 300 result += AffixUtils.unescapedCodePointCount(this, this); // suffix leng
th |
285 exitCharSequenceMode(); | 301 exitCharSequenceMode(); |
286 return result; | 302 return result; |
287 } | 303 } |
288 | 304 |
289 @Override | 305 @Override |
290 public boolean isStrong() { | 306 public boolean isStrong() { |
291 return isStrong; | 307 return isStrong; |
292 } | 308 } |
293 | 309 |
294 private int insertPrefix(NumberStringBuilder sb, int position) { | 310 private int insertPrefix(NumberStringBuilder sb, int position) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } else { | 346 } else { |
331 return currency.getName(symbols.getULocale(), Currency.SYMBOL_NA
ME, null); | 347 return currency.getName(symbols.getULocale(), Currency.SYMBOL_NA
ME, null); |
332 } | 348 } |
333 case AffixUtils.TYPE_CURRENCY_DOUBLE: | 349 case AffixUtils.TYPE_CURRENCY_DOUBLE: |
334 return currency.getCurrencyCode(); | 350 return currency.getCurrencyCode(); |
335 case AffixUtils.TYPE_CURRENCY_TRIPLE: | 351 case AffixUtils.TYPE_CURRENCY_TRIPLE: |
336 // NOTE: This is the code path only for patterns containing "¤¤¤". | 352 // NOTE: This is the code path only for patterns containing "¤¤¤". |
337 // Plural currencies set via the API are formatted in LongNameHandle
r. | 353 // Plural currencies set via the API are formatted in LongNameHandle
r. |
338 // This code path is used by DecimalFormat via CurrencyPluralInfo. | 354 // This code path is used by DecimalFormat via CurrencyPluralInfo. |
339 assert plural != null; | 355 assert plural != null; |
340 return currency.getName(symbols.getULocale(), Currency.PLURAL_LONG_N
AME, plural.getKeyword(), null); | 356 return currency |
| 357 .getName(symbols.getULocale(), Currency.PLURAL_LONG_NAME, pl
ural.getKeyword(), null); |
341 case AffixUtils.TYPE_CURRENCY_QUAD: | 358 case AffixUtils.TYPE_CURRENCY_QUAD: |
342 return "\uFFFD"; | 359 return "\uFFFD"; |
343 case AffixUtils.TYPE_CURRENCY_QUINT: | 360 case AffixUtils.TYPE_CURRENCY_QUINT: |
344 return currency.getName(symbols.getULocale(), Currency.NARROW_SYMBOL
_NAME, null); | 361 return currency.getName(symbols.getULocale(), Currency.NARROW_SYMBOL
_NAME, null); |
345 default: | 362 default: |
346 throw new AssertionError(); | 363 throw new AssertionError(); |
347 } | 364 } |
348 } | 365 } |
349 | 366 |
350 /** This method contains the heart of the logic for rendering LDML affix str
ings. */ | 367 /** This method contains the heart of the logic for rendering LDML affix str
ings. */ |
351 private void enterCharSequenceMode(boolean isPrefix) { | 368 private void enterCharSequenceMode(boolean isPrefix) { |
352 assert !inCharSequenceMode; | 369 assert !inCharSequenceMode; |
353 inCharSequenceMode = true; | 370 inCharSequenceMode = true; |
354 | 371 |
355 // Should the output render '+' where '-' would normally appear in the p
attern? | 372 // Should the output render '+' where '-' would normally appear in the p
attern? |
356 plusReplacesMinusSign = !isNegative | 373 plusReplacesMinusSign = !isNegative |
357 && (signDisplay == SignDisplay.ALWAYS || signDisplay == SignDisp
lay.ACCOUNTING_ALWAYS) | 374 && (signDisplay == SignDisplay.ALWAYS || signDisplay == SignDisp
lay.ACCOUNTING_ALWAYS) |
358 && patternInfo.positiveHasPlusSign() == false; | 375 && patternInfo.positiveHasPlusSign() == false; |
359 | 376 |
360 // Should we use the affix from the negative subpattern? (If not, we wil
l use the positive subpattern.) | 377 // Should we use the affix from the negative subpattern? (If not, we wil
l use the positive |
| 378 // subpattern.) |
361 boolean useNegativeAffixPattern = patternInfo.hasNegativeSubpattern() | 379 boolean useNegativeAffixPattern = patternInfo.hasNegativeSubpattern() |
362 && (isNegative || (patternInfo.negativeHasMinusSign() && plusRep
lacesMinusSign)); | 380 && (isNegative || (patternInfo.negativeHasMinusSign() && plusRep
lacesMinusSign)); |
363 | 381 |
364 // Resolve the flags for the affix pattern. | 382 // Resolve the flags for the affix pattern. |
365 flags = 0; | 383 flags = 0; |
366 if (useNegativeAffixPattern) { | 384 if (useNegativeAffixPattern) { |
367 flags |= AffixPatternProvider.Flags.NEGATIVE_SUBPATTERN; | 385 flags |= AffixPatternProvider.Flags.NEGATIVE_SUBPATTERN; |
368 } | 386 } |
369 if (isPrefix) { | 387 if (isPrefix) { |
370 flags |= AffixPatternProvider.Flags.PREFIX; | 388 flags |= AffixPatternProvider.Flags.PREFIX; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 435 } |
418 return candidate; | 436 return candidate; |
419 } | 437 } |
420 | 438 |
421 @Override | 439 @Override |
422 public CharSequence subSequence(int start, int end) { | 440 public CharSequence subSequence(int start, int end) { |
423 // Never called by AffixUtils | 441 // Never called by AffixUtils |
424 throw new AssertionError(); | 442 throw new AssertionError(); |
425 } | 443 } |
426 } | 444 } |
LEFT | RIGHT |