Search in sources :

Example 1 with CharacterIteratorWrapper

use of android.icu.impl.CharacterIteratorWrapper in project j2objc by google.

the class CollationElementIterator method setText.

/**
 * Set a new source string iterator for iteration, and reset the
 * offset to the beginning of the text.
 *
 * @param source the new source string iterator for iteration.
 */
public void setText(CharacterIterator source) {
    // Note: In C++, we just setText(source.getText()).
    // In Java, we actually operate on a character iterator.
    // TODO: do we need to remember the iterator in a field?
    // TODO: apparently we don't clone a CharacterIterator in Java,
    // we only clone the text for a UCharacterIterator?? see the old code in the constructors
    UCharacterIterator src = new CharacterIteratorWrapper(source);
    src.setToStart();
    // TODO: do we need to remember the source string in a field?
    string_ = src.getText();
    CollationIterator newIter;
    boolean numeric = rbc_.settings.readOnly().isNumeric();
    if (rbc_.settings.readOnly().dontCheckFCD()) {
        newIter = new IterCollationIterator(rbc_.data, numeric, src);
    } else {
        newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0);
    }
    iter_ = newIter;
    otherHalf_ = 0;
    dir_ = 0;
}
Also used : FCDIterCollationIterator(android.icu.impl.coll.FCDIterCollationIterator) UTF16CollationIterator(android.icu.impl.coll.UTF16CollationIterator) CollationIterator(android.icu.impl.coll.CollationIterator) FCDIterCollationIterator(android.icu.impl.coll.FCDIterCollationIterator) FCDUTF16CollationIterator(android.icu.impl.coll.FCDUTF16CollationIterator) IterCollationIterator(android.icu.impl.coll.IterCollationIterator) CharacterIteratorWrapper(android.icu.impl.CharacterIteratorWrapper) FCDIterCollationIterator(android.icu.impl.coll.FCDIterCollationIterator) IterCollationIterator(android.icu.impl.coll.IterCollationIterator)

Aggregations

CharacterIteratorWrapper (android.icu.impl.CharacterIteratorWrapper)1 CollationIterator (android.icu.impl.coll.CollationIterator)1 FCDIterCollationIterator (android.icu.impl.coll.FCDIterCollationIterator)1 FCDUTF16CollationIterator (android.icu.impl.coll.FCDUTF16CollationIterator)1 IterCollationIterator (android.icu.impl.coll.IterCollationIterator)1 UTF16CollationIterator (android.icu.impl.coll.UTF16CollationIterator)1