|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Spans | Line # 25 | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | package org.apache.lucene.search.spans; | |
| 2 | ||
| 3 | /** | |
| 4 | * Copyright 2004 The Apache Software Foundation | |
| 5 | * | |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | * you may not use this file except in compliance with the License. | |
| 8 | * You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, software | |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | * See the License for the specific language governing permissions and | |
| 16 | * limitations under the License. | |
| 17 | */ | |
| 18 | ||
| 19 | import java.io.IOException; | |
| 20 | ||
| 21 | /** Expert: an enumeration of span matches. Used to implement span searching. | |
| 22 | * Each span represents a range of term positions within a document. Matches | |
| 23 | * are enumerated in order, by increasing document number, within that by | |
| 24 | * increasing start position and finally by increasing end position. */ | |
| 25 | public interface Spans { | |
| 26 | /** Move to the next match, returning true iff any such exists. */ | |
| 27 | boolean next() throws IOException; | |
| 28 | ||
| 29 | /** Skips to the first match beyond the current, whose document number is | |
| 30 | * greater than or equal to <i>target</i>. <p>Returns true iff there is such | |
| 31 | * a match. <p>Behaves as if written: <pre> | |
| 32 | * boolean skipTo(int target) { | |
| 33 | * do { | |
| 34 | * if (!next()) | |
| 35 | * return false; | |
| 36 | * } while (target > doc()); | |
| 37 | * return true; | |
| 38 | * } | |
| 39 | * </pre> | |
| 40 | * Most implementations are considerably more efficient than that. | |
| 41 | */ | |
| 42 | boolean skipTo(int target) throws IOException; | |
| 43 | ||
| 44 | /** Returns the document number of the current match. Initially invalid. */ | |
| 45 | int doc(); | |
| 46 | ||
| 47 | /** Returns the start position of the current match. Initially invalid. */ | |
| 48 | int start(); | |
| 49 | ||
| 50 | /** Returns the end position of the current match. Initially invalid. */ | |
| 51 | int end(); | |
| 52 | ||
| 53 | } | |
|
||||||||||