public void setText ( UCharacterIterator source ) { string_ = source . getText ( ) ; // TODO: do we need to remember the source string in a field? // Note: In C++, we just setText(source.getText()). // In Java, we actually operate on a character iterator. // (The old code apparently did so only for a CharacterIterator; // for a UCharacterIterator it also just used source.getText()). // TODO: do we need to remember the cloned iterator in a field? UCharacterIterator src ; try { src = ( UCharacterIterator ) source . clone ( ) ; } catch ( CloneNotSupportedException e ) { // Fall back to ICU 52 behavior of iterating over the text contents // of the UCharacterIterator. setText ( source . getText ( ) ) ; return ; } src . setToStart ( ) ; 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 ; }
Set a new source string iterator for iteration and reset the offset to the beginning of the text .