1
2 package org.galagosearch.core.retrieval.structured;
3
4 import java.io.IOException;
5 import org.galagosearch.tupleflow.Parameters;
6
7 /***
8 *
9 * @author trevor
10 */
11 public abstract class ScoreCombinationIterator implements ScoreIterator {
12 ScoreIterator[] iterators;
13 boolean done;
14
15 public ScoreCombinationIterator(Parameters parameters, ScoreIterator[] childIterators) {
16 this.iterators = childIterators;
17 }
18
19 public double score(int document, int length) {
20 float total = 0;
21
22 for (ScoreIterator iterator : iterators) {
23 total += iterator.score(document, length);
24 }
25 return total;
26 }
27
28 public void movePast(int document) throws IOException {
29 for (ScoreIterator iterator : iterators) {
30 iterator.movePast(document);
31 }
32 }
33
34 public void moveTo(int document) throws IOException {
35 for (ScoreIterator iterator : iterators) {
36 iterator.moveTo(document);
37 }
38 }
39
40 public void reset() throws IOException {
41 for (ScoreIterator iterator : iterators) {
42 iterator.reset();
43 }
44 }
45 }