/** * 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()); } } }
/** * Returns the BreakIterator that is used to restrict the indexes at which * matches are detected. This will be the same object that was passed to * the constructor or to {@link #setBreakIterator}. * If the {@link BreakIterator} has not been set, <tt>null</tt> will be returned. * See {@link #setBreakIterator} for more information. * * @return the BreakIterator set to restrict logic matches * @see #setBreakIterator * @see BreakIterator * @stable ICU 2.0 */ public BreakIterator getBreakIterator() { return search_.breakIter(); }
private boolean isBreakBoundary(int index) { BreakIterator breakiterator = search_.breakIter(); if (breakiterator == null) { breakiterator = search_.internalBreakIter_; } return (breakiterator != null && breakiterator.isBoundary(index)); }
private int nextBoundaryAfter(int startIndex) { BreakIterator breakiterator = search_.breakIter(); if (breakiterator == null) { breakiterator = search_.internalBreakIter_; } if (breakiterator != null) { return breakiterator.following(startIndex); } return startIndex; }