@Override public CharacterIterator getText() { return (CharacterIterator)charIt.clone(); }
/** * @see UCharacterIterator#getCharacterIterator() */ @Override public CharacterIterator getCharacterIterator(){ return (CharacterIterator)iterator.clone(); } }
/** * Clones this iterator. * @return A newly-constructed RuleBasedBreakIterator with the same * behavior as this one. * @stable ICU 2.0 */ @Override public Object clone() { RuleBasedBreakIterator result = (RuleBasedBreakIterator)super.clone(); if (fText != null) { result.fText = (CharacterIterator)(fText.clone()); } return result; }
/** * Creates a clone of this iterator. Clones the underlying character iterator. * @see UCharacterIterator#clone() */ @Override public Object clone(){ try { CharacterIteratorWrapper result = (CharacterIteratorWrapper) super.clone(); result.iterator = (CharacterIterator)this.iterator.clone(); return result; } catch (CloneNotSupportedException e) { return null; // only invoked if bad underlying character iterator } }
/** * Reset the filter from the delegate. */ private final void resetState() { text = UCharacterIterator.getInstance((CharacterIterator) delegate.getText().clone()); }
/** * 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); }
/** * Creates a new <tt>Normalizer</tt> object for iterating over the * normalized form of the given text. * <p> * @param iter The input text to be normalized. The normalization * will start at the beginning of the string. * * @param mode The normalization mode. * * @param opt Any optional features to be enabled. * Currently the only available option is {@link #UNICODE_3_2}. * If you want the default behavior corresponding to one of the * standard Unicode Normalization Forms, use 0 for this argument. * @deprecated ICU 56 Use {@link Normalizer2} instead. */ @Deprecated public Normalizer(CharacterIterator iter, Mode mode, int opt) { this.text = UCharacterIterator.getInstance((CharacterIterator)iter.clone()); this.mode = mode; this.options = opt; norm2 = mode.getNormalizer2(opt); buffer = new StringBuilder(); }
/** * Set the BreakIterator that will be used to restrict the points * at which matches are detected. * * @param breakiter A BreakIterator that will be used to restrict the * points at which matches are detected. If a match is * found, but the match's start or end index is not a * boundary as determined by the {@link BreakIterator}, * the match will be rejected and another will be searched * for. If this parameter is <tt>null</tt>, no break * detection is attempted. * @see BreakIterator * @stable ICU 2.0 */ public void setBreakIterator(BreakIterator breakiter) { search_.setBreakIter(breakiter); if (search_.breakIter() != null) { // Create a clone of CharacterItearator, so it won't // affect the position currently held by search_.text() if (search_.text() != null) { search_.breakIter().setText((CharacterIterator)search_.text().clone()); } } }
search_.setBreakIter(breaker); if (search_.breakIter() != null) { search_.breakIter().setText((CharacterIterator)target.clone());
/** * 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(); }
search_.internalBreakIter_.setText((CharacterIterator)target.clone()); // We need to create a clone