@Override public int nextStartPosition() throws IOException { if (atFirstInCurrentDoc) { atFirstInCurrentDoc = false; return spanWindow.top().startPosition(); } assert spanWindow.top().startPosition() != -1; assert spanWindow.top().startPosition() != NO_MORE_POSITIONS; while (true) { if (! spanWindow.nextPosition()) { oneExhaustedInCurrentDoc = true; return NO_MORE_POSITIONS; } if (spanWindow.atMatch()) { return spanWindow.top().startPosition(); } } }
boolean nextPosition() throws IOException { Spans topSpans = top(); assert topSpans.startPosition() != NO_MORE_POSITIONS; int spanLength = topSpans.endPosition() - topSpans.startPosition(); int nextStartPos = topSpans.nextStartPosition(); if (nextStartPos == NO_MORE_POSITIONS) { return false; } totalSpanLength -= spanLength; spanLength = topSpans.endPosition() - topSpans.startPosition(); totalSpanLength += spanLength; if (topSpans.endPosition() > maxEndPosition) { maxEndPosition = topSpans.endPosition(); } updateTop(); return true; }
@Override public int width() { return spanWindow.maxEndPosition - spanWindow.top().startPosition(); }
boolean atMatch() { boolean res = (maxEndPosition - top().startPosition() - totalSpanLength) <= allowedSlop; return res; } }
@Override public int nextStartPosition() throws IOException { if (atFirstInCurrentDoc) { atFirstInCurrentDoc = false; return spanWindow.top().startPosition(); } assert spanWindow.top().startPosition() != -1; assert spanWindow.top().startPosition() != NO_MORE_POSITIONS; while (true) { if (! spanWindow.nextPosition()) { oneExhaustedInCurrentDoc = true; return NO_MORE_POSITIONS; } if (spanWindow.atMatch()) { return spanWindow.top().startPosition(); } } }
boolean nextPosition() throws IOException { Spans topSpans = top(); assert topSpans.startPosition() != NO_MORE_POSITIONS; int spanLength = topSpans.endPosition() - topSpans.startPosition(); int nextStartPos = topSpans.nextStartPosition(); if (nextStartPos == NO_MORE_POSITIONS) { return false; } totalSpanLength -= spanLength; spanLength = topSpans.endPosition() - topSpans.startPosition(); totalSpanLength += spanLength; if (topSpans.endPosition() > maxEndPosition) { maxEndPosition = topSpans.endPosition(); } updateTop(); return true; }
@Override public int width() { return spanWindow.maxEndPosition - spanWindow.top().startPosition(); }
boolean atMatch() { boolean res = (maxEndPosition - top().startPosition() - totalSpanLength) <= allowedSlop; return res; } }