/** * Return a CollationElementIterator for the given UCharacterIterator. The source iterator's integrity will be * preserved since a new copy will be created for use. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(UCharacterIterator source) { initMaxExpansions(); return new CollationElementIterator(source, this); }
/** * Return a CollationElementIterator for the given String. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(String source) { initMaxExpansions(); return new CollationElementIterator(source, this); }
/** * Return a CollationElementIterator for the given CharacterIterator. The source iterator's integrity will be * preserved since a new copy will be created for use. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(CharacterIterator source) { initMaxExpansions(); CharacterIterator newsource = (CharacterIterator) source.clone(); return new CollationElementIterator(newsource, this); }
/** * Sets the {@link RuleBasedCollator} to be used for language-specific searching. * <p> * The iterator's position will not be changed by this method. * @param collator to use for this <tt>StringSearch</tt> * @throws IllegalArgumentException thrown when collator is null * @see #getCollator * @stable ICU 2.0 */ public void setCollator(RuleBasedCollator collator) { if (collator == null) { throw new IllegalArgumentException("Collator can not be null"); } collator_ = collator; ceMask_ = getMask(collator_.getStrength()); ULocale collLocale = collator.getLocale(ULocale.VALID_LOCALE); search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale); search_.internalBreakIter_.setText((CharacterIterator)search_.text().clone()); // We need to create a clone toShift_ = collator.isAlternateHandlingShifted(); variableTop_ = collator.getVariableTop(); textIter_ = new CollationElementIterator(pattern_.text_, collator); utilIter_ = new CollationElementIterator(pattern_.text_, collator); // initialize() _after_ setting the iterators for the new collator. initialize(); }
coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else {
coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else {
textIter_ = new CollationElementIterator(target, collator);