@Override public Object clone() { SimpleFilteredSentenceBreakIterator other = (SimpleFilteredSentenceBreakIterator) super.clone(); return other; }
BreakIterator createBreakInstance() { return (BreakIterator) iter.clone(); } }
@Override public BreakIterator getBreakIterator(int script) { switch(script) { case UScript.THAI: return (BreakIterator)thaiBreakIterator.clone(); case UScript.HEBREW: return (BreakIterator)hebrewBreakIterator.clone(); case UScript.KHMER: return (BreakIterator)khmerBreakIterator.clone(); case UScript.LAO: return (BreakIterator)laoBreakIterator.clone(); case UScript.MYANMAR: return (BreakIterator)myanmarBreakIterator.clone(); default: return (BreakIterator)rootBreakIterator.clone(); } }
BreakIteratorCache(ULocale where, BreakIterator iter) { this.where = where; this.iter = (BreakIterator) iter.clone(); }
@Override public Object clone() { BreakIteratorICU other = (BreakIteratorICU)super.clone(); other.fIcuBrkItr = (BreakIterator)fIcuBrkItr.clone(); return other; }
@Override public RuleBasedBreakIterator getBreakIterator(int script) { if (breakers[script] != null) { return (RuleBasedBreakIterator) breakers[script].clone(); } else { return super.getBreakIterator(script); } } // TODO: we could also allow codes->types mapping
/** * Returns the ICU {@link BreakIterator} instance. * * @return the BreakIterator instance */ public BreakIterator getBreakIterator() { if (breakIterator == null) { breakIterator = createBreakIterator(); } return (BreakIterator) breakIterator.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; }
/** * Get a copy of the break iterator for the specified type according to the * settings. * * @param type break type - BI_CHARACTER or BI_WORD, BI_LINE, BI_SENTENCE, BI_TITLE * @return break iterator explicit or implicit * @draft ICU 3.6 * @provisional This API might change or be removed in a future release. */ public BreakIterator getBreakIterator(int type) { if (type < BI_CHARACTER || type >= BI_LIMIT) { throw new IllegalArgumentException("Illegal break iterator type"); } if (breakIterators == null || breakIterators[type] == null) { return guessBreakIterator(type); } return (BreakIterator) breakIterators[type].clone(); // clone for safety }
/** * Explicitly set the break iterator for this object. * * @param type break type - BI_CHARACTER or BI_WORD, BI_LINE, BI_SENTENCE, BI_TITLE * @param iterator a break iterator * @return this, for chaining * @draft ICU 3.6 * @provisional This API might change or be removed in a future release. */ public GlobalizationPreferences setBreakIterator(int type, BreakIterator iterator) { if (type < BI_CHARACTER || type >= BI_LIMIT) { throw new IllegalArgumentException("Illegal break iterator type"); } if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify immutable object"); } if (breakIterators == null) breakIterators = new BreakIterator[BI_LIMIT]; breakIterators[type] = (BreakIterator) iterator.clone(); // clone for safety return this; }
@Override public RuleBasedBreakIterator getBreakIterator(int script) { switch(script) { case UScript.JAPANESE: return (RuleBasedBreakIterator)cjkBreakIterator.clone(); case UScript.MYANMAR: if (myanmarAsWords) { return (RuleBasedBreakIterator)defaultBreakIterator.clone(); } else { return (RuleBasedBreakIterator)myanmarSyllableIterator.clone(); } default: return (RuleBasedBreakIterator)defaultBreakIterator.clone(); } }
/** * Clone method. Creates another LaoBreakIterator with the same behavior * and current state as this one. * @return The clone. */ @Override public Object clone() { LaoBreakIterator other = (LaoBreakIterator) super.clone(); other.rules = (RuleBasedBreakIterator) rules.clone(); other.verify = (RuleBasedBreakIterator) verify.clone(); if (text != null) other.text = (CharArrayIterator) text.clone(); if (working != null) other.working = (CharArrayIterator) working.clone(); if (verifyText != null) other.verifyText = (CharArrayIterator) verifyText.clone(); return other; } }