ICU-6958 Remove BreakDictionary from public view. Add test in RBBITest for better code coverage of DictionaryBasedBreakIterator.

X-SVN-Rev: 26075
This commit is contained in:
Michael Ow 2009-06-08 20:18:17 +00:00
parent d6400a1a70
commit bbdb417578
2 changed files with 19 additions and 7 deletions

View file

@ -15,6 +15,7 @@ package com.ibm.icu.dev.test.rbbi;
// which is common between ICU4C and ICU4J. The remaining test data should also be moved,
// or simply retired if it is no longer interesting.
import com.ibm.icu.dev.test.*;
import com.ibm.icu.text.DictionaryBasedBreakIterator;
import com.ibm.icu.text.RuleBasedBreakIterator;
import com.ibm.icu.text.BreakIterator;
import com.ibm.icu.util.ULocale;
@ -566,6 +567,17 @@ public class RBBITest extends TestFmwk
errln("Incorrect break given by thai line break iterator. Expected: " + expectedLineResult[index-1] + " Got: " + position);
}
}
// Improve code coverage
if (brk.preceding(expectedLineResult[1]) != expectedLineResult[0]) {
errln("Incorrect preceding position.");
}
if (brk.following(expectedLineResult[1]) != expectedLineResult[2]) {
errln("Incorrect following position.");
}
int []fillInArray = new int[2];
if (((DictionaryBasedBreakIterator)brk).getRuleStatusVec(fillInArray) != 1 || fillInArray[0] != 0) {
errln("Error: Since getRuleStatusVec is not supported in DictionaryBasedBreakIterator, it should return 1 and fillInArray[0] == 0.");
}
}
public void TestTailoredBreaks() {

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -31,7 +31,7 @@ import com.ibm.icu.util.CompactByteArray;
* @internal
* @deprecated This API is ICU internal only.
*/
public class BreakDictionary {
/* public */ class BreakDictionary {
//=================================================================================
// testing and debugging
//=================================================================================
@ -62,7 +62,7 @@ public class BreakDictionary {
* @internal
* @deprecated This API is ICU internal only.
*/
public void printWordList(String partialWord, int state, PrintWriter out)
/* public */ void printWordList(String partialWord, int state, PrintWriter out)
throws IOException {
if (state == 0xFFFF) {
System.out.println(partialWord);
@ -166,7 +166,7 @@ public class BreakDictionary {
* @internal
* @deprecated This API is ICU internal only.
*/
public BreakDictionary(InputStream dictionaryStream) throws IOException {
/* public */ BreakDictionary(InputStream dictionaryStream) throws IOException {
readDictionaryFile(new DataInputStream(dictionaryStream));
}
@ -174,7 +174,7 @@ public class BreakDictionary {
* @internal
* @deprecated This API is ICU internal only.
*/
public void readDictionaryFile(DataInputStream in) throws IOException {
/* public */ void readDictionaryFile(DataInputStream in) throws IOException {
int l;
// read in the version number (right now we just ignore it)
@ -250,7 +250,7 @@ public class BreakDictionary {
* @internal
* @deprecated This API is ICU internal only.
*/
public final short at(int row, char ch) {
/* public */ final short at(int row, char ch) {
int col = columnMap.elementAt(ch);
return at(row, col);
}
@ -268,7 +268,7 @@ public class BreakDictionary {
* @internal
* @deprecated This API is ICU internal only.
*/
public final short at(int row, int col) {
/* public */ final short at(int row, int col) {
if (cellIsPopulated(row, col)) {
// we map from logical to physical row number by looking up the
// mapping in rowIndex; we map from logical column number to