mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-06 14:05:32 +00:00
ICU-21599 Move LanguageBreakEngine classes to com.ibm.icu.impl.breakiter
This commit is contained in:
parent
d74233f973
commit
24f3864756
13 changed files with 48 additions and 29 deletions
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.CharacterIterator;
|
||||
|
@ -14,8 +14,10 @@ import java.text.CharacterIterator;
|
|||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
class BurmeseBreakEngine extends DictionaryBreakEngine {
|
||||
|
||||
public class BurmeseBreakEngine extends DictionaryBreakEngine {
|
||||
|
||||
// Constants for BurmeseBreakIterator
|
||||
// How many words in a row are "good enough"?
|
|
@ -6,11 +6,12 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
||||
import com.ibm.icu.impl.Assert;
|
||||
import com.ibm.icu.text.UCharacterIterator;
|
||||
import com.ibm.icu.util.BytesTrie;
|
||||
import com.ibm.icu.util.BytesTrie.Result;
|
||||
|
|
@ -6,10 +6,11 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
||||
import com.ibm.icu.text.UCharacterIterator;
|
||||
import com.ibm.icu.util.BytesTrie.Result;
|
||||
import com.ibm.icu.util.CharsTrie;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import static com.ibm.icu.impl.CharacterIteration.DONE32;
|
||||
import static com.ibm.icu.impl.CharacterIteration.current32;
|
||||
|
@ -16,8 +16,10 @@ import java.io.IOException;
|
|||
import java.text.CharacterIterator;
|
||||
|
||||
import com.ibm.icu.impl.Assert;
|
||||
import com.ibm.icu.text.Normalizer;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
class CjkBreakEngine extends DictionaryBreakEngine {
|
||||
public class CjkBreakEngine extends DictionaryBreakEngine {
|
||||
private static final UnicodeSet fHangulWordSet = new UnicodeSet();
|
||||
private static final UnicodeSet fHanWordSet = new UnicodeSet();
|
||||
private static final UnicodeSet fKatakanaWordSet = new UnicodeSet();
|
|
@ -6,13 +6,14 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
||||
import com.ibm.icu.impl.CharacterIteration;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
||||
public abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
||||
|
||||
/* Helper class for improving readability of the Thai/Lao/Khmer word break
|
||||
* algorithm.
|
||||
|
@ -88,7 +89,7 @@ abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
|||
* For internal use only.
|
||||
* @internal
|
||||
*/
|
||||
static class DequeI implements Cloneable {
|
||||
public static class DequeI implements Cloneable {
|
||||
private int[] data = new int[50];
|
||||
private int lastIdx = 4; // or base of stack. Index of element.
|
||||
private int firstIdx = 4; // or Top of Stack. Index of element + 1.
|
||||
|
@ -100,11 +101,11 @@ abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
|||
return result;
|
||||
}
|
||||
|
||||
int size() {
|
||||
public int size() {
|
||||
return firstIdx - lastIdx;
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
public boolean isEmpty() {
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
|
@ -114,26 +115,26 @@ abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
|||
data = newData;
|
||||
}
|
||||
|
||||
void offer(int v) {
|
||||
public void offer(int v) {
|
||||
// Note that the actual use cases of offer() add at most one element.
|
||||
// We make no attempt to handle more than a few.
|
||||
assert lastIdx > 0;
|
||||
data[--lastIdx] = v;
|
||||
}
|
||||
|
||||
void push(int v) {
|
||||
public void push(int v) {
|
||||
if (firstIdx >= data.length) {
|
||||
grow();
|
||||
}
|
||||
data[firstIdx++] = v;
|
||||
}
|
||||
|
||||
int pop() {
|
||||
public int pop() {
|
||||
assert size() > 0;
|
||||
return data[--firstIdx];
|
||||
}
|
||||
|
||||
int peek() {
|
||||
public int peek() {
|
||||
assert size() > 0;
|
||||
return data[firstIdx - 1];
|
||||
}
|
||||
|
@ -157,12 +158,12 @@ abstract class DictionaryBreakEngine implements LanguageBreakEngine {
|
|||
return false;
|
||||
}
|
||||
|
||||
int elementAt(int i) {
|
||||
public int elementAt(int i) {
|
||||
assert i < size();
|
||||
return data[lastIdx + i];
|
||||
}
|
||||
|
||||
void removeAllElements() {
|
||||
public void removeAllElements() {
|
||||
lastIdx = firstIdx = 4;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.CharacterIterator;
|
||||
|
@ -14,8 +14,9 @@ import java.text.CharacterIterator;
|
|||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
class KhmerBreakEngine extends DictionaryBreakEngine {
|
||||
public class KhmerBreakEngine extends DictionaryBreakEngine {
|
||||
|
||||
// Constants for KhmerBreakIterator
|
||||
// How many words in a row are "good enough"?
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import java.text.CharacterIterator;
|
|||
* The LanguageBreakEngine interface is to be used to implement any
|
||||
* language-specific logic for break iteration.
|
||||
*/
|
||||
interface LanguageBreakEngine {
|
||||
public interface LanguageBreakEngine {
|
||||
/**
|
||||
* @param c A Unicode codepoint value
|
||||
* @return true if the engine can handle this character, false otherwise
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.CharacterIterator;
|
||||
|
@ -14,8 +14,9 @@ import java.text.CharacterIterator;
|
|||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
class LaoBreakEngine extends DictionaryBreakEngine {
|
||||
public class LaoBreakEngine extends DictionaryBreakEngine {
|
||||
|
||||
// Constants for LaoBreakIterator
|
||||
// How many words in a row are "good enough"?
|
|
@ -6,7 +6,7 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.CharacterIterator;
|
||||
|
@ -14,8 +14,9 @@ import java.text.CharacterIterator;
|
|||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
class ThaiBreakEngine extends DictionaryBreakEngine {
|
||||
public class ThaiBreakEngine extends DictionaryBreakEngine {
|
||||
|
||||
// Constants for ThaiBreakIterator
|
||||
// How many words in a row are "good enough"?
|
|
@ -6,15 +6,16 @@
|
|||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
package com.ibm.icu.impl.breakiter;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
|
||||
import com.ibm.icu.impl.CharacterIteration;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
final class UnhandledBreakEngine implements LanguageBreakEngine {
|
||||
public final class UnhandledBreakEngine implements LanguageBreakEngine {
|
||||
// TODO: Use two UnicodeSets, one with all frozen sets, one with unfrozen.
|
||||
// in handleChar(), update the unfrozen version, clone, freeze, replace the frozen one.
|
||||
|
|
@ -26,6 +26,14 @@ import com.ibm.icu.impl.CharacterIteration;
|
|||
import com.ibm.icu.impl.ICUBinary;
|
||||
import com.ibm.icu.impl.ICUDebug;
|
||||
import com.ibm.icu.impl.RBBIDataWrapper;
|
||||
import com.ibm.icu.impl.breakiter.BurmeseBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.CjkBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.DictionaryBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.KhmerBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.LanguageBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.LaoBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.ThaiBreakEngine;
|
||||
import com.ibm.icu.impl.breakiter.UnhandledBreakEngine;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
|
|
Loading…
Add table
Reference in a new issue