/** * {@inheritDoc} * @stable ICU 2.8 */ @Override public void setIndex(int position) { // Java porting note: This method is equivalent to setOffset() in ICU4C. // ICU4C SearchIterator::setOffset() is a pure virtual method, while // ICU4J SearchIterator.setIndex() is not abstract method. super.setIndex(position); textIter_.setOffset(position); }
/** * @internal * @deprecated This API is ICU internal only. */ @Deprecated protected void setMatchNotFound() { super.setMatchNotFound(); // SearchIterator#setMatchNotFound() does following: // search_.matchedIndex_ = DONE; // search_.setMatchedLength(0); if (search_.isForwardSearching_) { textIter_.setOffset(search_.text().getEndIndex()); } else { textIter_.setOffset(0); } }
getIndex() : search_.matchedIndex_ + 1; search_.setMatchedLength(0); textIter_.setOffset(search_.matchedIndex_); if (search_.matchedIndex_ == search_.endIndex()) { search_.matchedIndex_ = DONE; textIter_.setOffset(position); textIter_.setOffset(search_.endIndex()); } else { textIter_.setOffset(search_.matchedIndex_);
/** * {@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_; }
strIter.setOffset(startingAt);
textIter_.setOffset(startIdx); CEBuffer ceb = new CEBuffer(this);