Search in sources :

Example 96 with BreakIterator

use of java.text.BreakIterator in project j2objc by google.

the class BreakIteratorTest method testCache.

public void testCache() {
    BreakIterator newOne = BreakIterator.getCharacterInstance(Locale.US);
    assertNotSame(newOne, iterator);
    assertEquals(newOne, iterator);
    newOne = BreakIterator.getCharacterInstance();
    assertEquals(newOne, iterator);
    newOne = BreakIterator.getCharacterInstance(Locale.CHINA);
    assertEquals(newOne, iterator);
    BreakIterator wordIterator = BreakIterator.getWordInstance();
    assertFalse(wordIterator.equals(iterator));
    BreakIterator lineIterator = BreakIterator.getLineInstance();
    assertFalse(lineIterator.equals(iterator));
    BreakIterator senteIterator = BreakIterator.getSentenceInstance();
    assertFalse(senteIterator.equals(iterator));
}
Also used : BreakIterator(java.text.BreakIterator)

Example 97 with BreakIterator

use of java.text.BreakIterator in project j2objc by google.

the class BreakIteratorTest method testGetWordInstanceLocale.

/*
     * Class under test for BreakIterator getWordInstance(Locale)
     */
public void testGetWordInstanceLocale() {
    BreakIterator it = BreakIterator.getWordInstance(Locale.US);
    assertNotNull(it);
}
Also used : BreakIterator(java.text.BreakIterator)

Example 98 with BreakIterator

use of java.text.BreakIterator in project j2objc by google.

the class BreakIteratorTest method testClone.

public void testClone() {
    BreakIterator cloned = (BreakIterator) iterator.clone();
    assertNotSame(cloned, iterator);
    assertEquals(cloned, iterator);
}
Also used : BreakIterator(java.text.BreakIterator)

Example 99 with BreakIterator

use of java.text.BreakIterator in project j2objc by google.

the class BreakIteratorTest method testFollowing.

public void testFollowing() {
    BreakIterator it = BreakIterator.getCharacterInstance(Locale.US);
    it.setText("hello");
    try {
        it.following(-1);
        fail();
    } catch (IllegalArgumentException expected) {
    // Expected exception
    }
    assertEquals(1, it.following(0));
    assertEquals(2, it.following(1));
    assertEquals(5, it.following(4));
    assertEquals(BreakIterator.DONE, it.following(5));
    try {
        it.following(6);
        fail();
    } catch (IllegalArgumentException expected) {
    // Expected exception
    }
}
Also used : BreakIterator(java.text.BreakIterator)

Example 100 with BreakIterator

use of java.text.BreakIterator in project j2objc by google.

the class BreakIteratorTest method testPreceding.

public void testPreceding() {
    BreakIterator it = BreakIterator.getCharacterInstance(Locale.US);
    it.setText("hello");
    try {
        it.preceding(-1);
        fail();
    } catch (IllegalArgumentException expected) {
    // Expected exception
    }
    assertEquals(BreakIterator.DONE, it.preceding(0));
    assertEquals(0, it.preceding(1));
    assertEquals(4, it.preceding(5));
    try {
        it.preceding(6);
        fail();
    } catch (IllegalArgumentException expected) {
    // Expected exception
    }
}
Also used : BreakIterator(java.text.BreakIterator)

Aggregations

BreakIterator (java.text.BreakIterator)120 ArrayList (java.util.ArrayList)17 Locale (java.util.Locale)9 Paint (android.graphics.Paint)4 IntPair (edu.illinois.cs.cogcomp.core.datastructures.IntPair)3 BytesRef (org.apache.lucene.util.BytesRef)3 SuppressLint (android.annotation.SuppressLint)2 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)2 Collection (java.util.Collection)2 BadLocationException (javax.swing.text.BadLocationException)2 Document (javax.swing.text.Document)2 Element (javax.swing.text.Element)2 Segment (javax.swing.text.Segment)2 Snippet (org.apache.lucene.search.highlight.Snippet)2 Intent (android.content.Intent)1 RectF (android.graphics.RectF)1 TextPaint (android.text.TextPaint)1 TagElement (com.google.devtools.j2objc.ast.TagElement)1 Token (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token)1 AbstractNLPDecoder (edu.emory.mathcs.nlp.decode.AbstractNLPDecoder)1