| 1 | |
|
| 2 | |
package org.galagosearch.core.retrieval.structured; |
| 3 | |
|
| 4 | |
import java.io.IOException; |
| 5 | |
import java.util.ArrayList; |
| 6 | |
import org.galagosearch.tupleflow.Parameters; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
public class ScaleIterator implements ScoreIterator { |
| 13 | |
ScoreIterator iterator; |
| 14 | |
double weight; |
| 15 | |
|
| 16 | 0 | public ScaleIterator(Parameters parameters, ScoreIterator iterator) throws IllegalArgumentException { |
| 17 | 0 | this.iterator = iterator; |
| 18 | 0 | weight = parameters.get("weight", 1.0); |
| 19 | 0 | } |
| 20 | |
|
| 21 | |
public int nextCandidate() { |
| 22 | 0 | return iterator.nextCandidate(); |
| 23 | |
} |
| 24 | |
|
| 25 | |
public boolean hasMatch(int document) { |
| 26 | 0 | return iterator.hasMatch(document); |
| 27 | |
} |
| 28 | |
|
| 29 | |
public void moveTo(int document) throws IOException { |
| 30 | 0 | iterator.moveTo(document); |
| 31 | 0 | } |
| 32 | |
|
| 33 | |
public void movePast(int document) throws IOException { |
| 34 | 0 | iterator.movePast(document); |
| 35 | 0 | } |
| 36 | |
|
| 37 | |
public double score(int document, int length) { |
| 38 | 0 | return weight * iterator.score(document, length); |
| 39 | |
} |
| 40 | |
|
| 41 | |
public boolean isDone() { |
| 42 | 0 | return iterator.isDone(); |
| 43 | |
} |
| 44 | |
|
| 45 | |
public void reset() throws IOException { |
| 46 | 0 | iterator.reset(); |
| 47 | 0 | } |
| 48 | |
} |