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 * @author trevor
11 */
12 public class ScaleIterator implements ScoreIterator {
13 ScoreIterator iterator;
14 double weight;
15
16 public ScaleIterator(Parameters parameters, ScoreIterator iterator) throws IllegalArgumentException {
17 this.iterator = iterator;
18 weight = parameters.get("weight", 1.0);
19 }
20
21 public int nextCandidate() {
22 return iterator.nextCandidate();
23 }
24
25 public boolean hasMatch(int document) {
26 return iterator.hasMatch(document);
27 }
28
29 public void moveTo(int document) throws IOException {
30 iterator.moveTo(document);
31 }
32
33 public void movePast(int document) throws IOException {
34 iterator.movePast(document);
35 }
36
37 public double score(int document, int length) {
38 return weight * iterator.score(document, length);
39 }
40
41 public boolean isDone() {
42 return iterator.isDone();
43 }
44
45 public void reset() throws IOException {
46 iterator.reset();
47 }
48 }