Coverage Report - org.galagosearch.core.retrieval.structured.UnfilteredCombinationIterator
 
Classes in this File Line Coverage Branch Coverage Complexity
UnfilteredCombinationIterator
100%
16/16
93%
13/14
0
 
 1  
 /*
 2  
  * To change this template, choose Tools | Templates
 3  
  * and open the template in the editor.
 4  
  */
 5  
 package org.galagosearch.core.retrieval.structured;
 6  
 
 7  
 import java.util.ArrayList;
 8  
 import org.galagosearch.tupleflow.Parameters;
 9  
 
 10  
 /**
 11  
  *
 12  
  * @author trevor
 13  
  */
 14  
 public class UnfilteredCombinationIterator extends ScoreCombinationIterator {
 15  
     public UnfilteredCombinationIterator(Parameters parameters, ScoreIterator[] childIterators) {
 16  24
         super(parameters, childIterators);
 17  24
     }
 18  
 
 19  
     public int nextCandidate() {
 20  44
         int candidate = Integer.MAX_VALUE;
 21  
 
 22  132
         for (ScoreIterator iterator : iterators) {
 23  88
             if (iterator.isDone()) {
 24  4
                 continue;
 25  
             }
 26  84
             candidate = Math.min(candidate, iterator.nextCandidate());
 27  
         }
 28  
 
 29  44
         return candidate;
 30  
     }
 31  
 
 32  
     public boolean hasMatch(int document) {
 33  112
         for (ScoreIterator iterator : iterators) {
 34  104
             if (!iterator.isDone() && iterator.hasMatch(document)) {
 35  52
                 return true;
 36  
             }
 37  
         }
 38  
 
 39  8
         return false;
 40  
     }
 41  
     
 42  
     public boolean isDone() {
 43  96
         for (ScoreIterator iterator : iterators) {
 44  88
             if (!iterator.isDone()) {
 45  68
                 return false;
 46  
             }
 47  
         }
 48  
 
 49  8
         return true;
 50  
     }
 51  
 }