OLD | NEW |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 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 /* | 3 /* |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * Copyright (C) 2014, International Business Machines Corporation and * | 5 * Copyright (C) 2014, International Business Machines Corporation and * |
6 * others. All Rights Reserved. * | 6 * others. All Rights Reserved. * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 */ | 8 */ |
9 package com.ibm.icu.text; | 9 package com.ibm.icu.text; |
10 | 10 |
11 import java.text.CharacterIterator; | 11 import java.text.CharacterIterator; |
12 | 12 |
13 /** | 13 /** |
14 * The LanguageBreakEngine interface is to be used to implement any | 14 * The LanguageBreakEngine interface is to be used to implement any |
15 * language-specific logic for break iteration. | 15 * language-specific logic for break iteration. |
16 */ | 16 */ |
17 interface LanguageBreakEngine { | 17 interface LanguageBreakEngine { |
18 /** | 18 /** |
19 * @param c A Unicode codepoint value | 19 * @param c A Unicode codepoint value |
20 * @param breakType The kind of break iterator that is wanting to make use | 20 * @param breakType The kind of break iterator that is wanting to make use |
21 * of this engine - character, word, line, sentence | 21 * of this engine - character, word, line, sentence |
22 * @return true if the engine can handle this character, false otherwise | 22 * @return true if the engine can handle this character, false otherwise |
23 */ | 23 */ |
24 boolean handles(int c, int breakType); | 24 boolean handles(int c, int breakType); |
25 | 25 |
26 /** | 26 /** |
27 * Implements the actual breaking logic. | 27 * Implements the actual breaking logic. Find any breaks within a run in the
supplied text. |
28 * @param text The text to break over | 28 * @param text The text to break over. The iterator is left at |
29 * @param startPos The index of the beginning of our range | 29 * the end of the run of characters which the engine has handled. |
| 30 * @param startPos The index of the beginning of the range |
30 * @param endPos The index of the possible end of our range. It is possible, | 31 * @param endPos The index of the possible end of our range. It is possible, |
31 * however, that our range ends earlier | 32 * however, that the range ends earlier |
32 * @param reverse true iff we are iterating backwards (in a call to· | |
33 * previous(), for example) | |
34 * @param breakType The kind of break iterator that is wanting to make use | 33 * @param breakType The kind of break iterator that is wanting to make use |
35 * of this engine - character, word, line, sentence | 34 * of this engine - character, word, line, sentence |
36 * @param foundBreaks A Stack that the breaks found will be added to | 35 * @param foundBreaks A data structure to receive the break positions. |
37 * @return the number of words found | 36 * @return the number of breaks found |
38 */ | 37 */ |
39 int findBreaks(CharacterIterator text, int startPos, int endPos, | 38 int findBreaks(CharacterIterator text, int startPos, int endPos, |
40 boolean reverse, int breakType, DictionaryBreakEngine.DequeI foundBr
eaks); | 39 int breakType, DictionaryBreakEngine.DequeI foundBreaks); |
41 } | 40 } |
42 ···· | 41 |
43 ···· | 42 |
44 ···· | 43 |
OLD | NEW |