/** * @internal * @deprecated This API is ICU internal only. */ @Deprecated //TODO: This protected method is @stable 2.0 in ICU4C protected void setMatchNotFound() { search_.matchedIndex_ = DONE; search_.setMatchedLength(0); }
/** * <p> * Sets the position in the target text at which the next search will start. * This method clears any previous match. * </p> * @param position position from which to start the next search * @exception IndexOutOfBoundsException thrown if argument position is out * of the target text range. * @see #getIndex * @stable ICU 2.8 */ public void setIndex(int position) { if (position < search_.beginIndex() || position > search_.endIndex()) { throw new IndexOutOfBoundsException( "setIndex(int) expected position to be between " + search_.beginIndex() + " and " + search_.endIndex()); } search_.reset_ = false; search_.setMatchedLength(0); search_.matchedIndex_ = DONE; }
search_.reset_ = true; search_.matchedIndex_ = DONE; search_.setMatchedLength(0);
search_.setMatchedLength(0); search_.matchedIndex_ = DONE;
search_.matchedIndex_ = search_.matchedIndex_ == DONE ? getIndex() : search_.matchedIndex_ + 1; search_.setMatchedLength(0); textIter_.setOffset(search_.matchedIndex_); if (search_.matchedIndex_ == search_.endIndex()) {
search_.setMatchedLength(0); search_.matchedIndex_ = DONE; search_.isOverlap_ = false;
if (searchBackwards(textOffset, match)) { search_.matchedIndex_ = match.start_; search_.setMatchedLength(match.limit_ - match.start_); return true; } else {
search_.setTarget(text); search_.matchedIndex_ = DONE; search_.setMatchedLength(0); search_.reset_ = true; search_.isForwardSearching_ = true;
/** * {@inheritDoc} * @stable ICU 2.8 */ @Override protected int handlePrevious(int position) { if (pattern_.CELength_ == 0) { search_.matchedIndex_ = search_.matchedIndex_ == DONE ? getIndex() : search_.matchedIndex_; if (search_.matchedIndex_ == search_.beginIndex()) { setMatchNotFound(); } else { search_.matchedIndex_--; textIter_.setOffset(search_.matchedIndex_); search_.setMatchedLength(0); } } else { textIter_.setOffset(position); if (search_.isCanonicalMatch_) { // *could* use exact match here since extra accents *not* allowed! handlePreviousCanonical(); } else { handlePreviousExact(); } } return search_.matchedIndex_; }
/** * Sets the length of the most recent match in the target text. * Subclasses' handleNext() and handlePrevious() methods should call this * after they find a match in the target text. * * @param length new length to set * @see #handleNext * @see #handlePrevious * @stable ICU 2.0 */ protected void setMatchLength(int length) { search_.setMatchedLength(length); }
private boolean handleNextCommonImpl() { int textOffset = textIter_.getOffset(); Match match = new Match(); if (search(textOffset, match)) { search_.matchedIndex_ = match.start_; search_.setMatchedLength(match.limit_ - match.start_); return true; } else { setMatchNotFound(); return false; } }