Coverage Report - org.galagosearch.core.retrieval.structured.ScoreCombinationIterator
 
Classes in this File Line Coverage Branch Coverage Complexity
ScoreCombinationIterator
81%
13/16
75%
6/8
0
 
 1  
 // BSD License (http://www.galagosearch.org/license)
 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  56
     public ScoreCombinationIterator(Parameters parameters, ScoreIterator[] childIterators) {
 16  56
         this.iterators = childIterators;
 17  56
     }
 18  
 
 19  
     public double score(int document, int length) {
 20  124
         float total = 0;
 21  
 
 22  372
         for (ScoreIterator iterator : iterators) {
 23  248
             total += iterator.score(document, length);
 24  
         }
 25  124
         return total;
 26  
     }
 27  
 
 28  
     public void movePast(int document) throws IOException {
 29  456
         for (ScoreIterator iterator : iterators) {
 30  304
             iterator.movePast(document);
 31  
         }
 32  152
     }
 33  
 
 34  
     public void moveTo(int document) throws IOException {
 35  72
         for (ScoreIterator iterator : iterators) {
 36  48
             iterator.moveTo(document);
 37  
         }
 38  24
     }
 39  
 
 40  
     public void reset() throws IOException {
 41  0
         for (ScoreIterator iterator : iterators) {
 42  0
             iterator.reset();
 43  
         }
 44  0
     }
 45  
 }