Coverage Report - org.galagosearch.core.parse.CollectionLengthCounter
 
Classes in this File Line Coverage Branch Coverage Complexity
CollectionLengthCounter
0%
0/10
N/A
0
 
 1  
 // BSD License (http://www.galagosearch.org/license)
 2  
 
 3  
 package org.galagosearch.core.parse;
 4  
 
 5  
 import java.io.IOException;
 6  
 import org.galagosearch.core.types.DocumentData;
 7  
 import org.galagosearch.tupleflow.InputClass;
 8  
 import org.galagosearch.tupleflow.OutputClass;
 9  
 import org.galagosearch.tupleflow.StandardStep;
 10  
 import org.galagosearch.tupleflow.execution.Verified;
 11  
 import org.galagosearch.tupleflow.types.XMLFragment;
 12  
 
 13  
 /**
 14  
  *
 15  
  * @author trevor
 16  
  */
 17  
 @Verified
 18  
 @InputClass(className = "org.galagosearch.core.types.DocumentData")
 19  
 @OutputClass(className = "org.galagosearch.tupleflow.types.XMLFragment")
 20  0
 public class CollectionLengthCounter extends StandardStep<DocumentData, XMLFragment> {
 21  0
     long collectionLength = 0;
 22  0
     long documentCount = 0;
 23  
 
 24  
     public void process(DocumentData data) {
 25  0
         collectionLength += data.textLength;
 26  0
         documentCount += 1;
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public void close() throws IOException {
 31  0
         processor.process(new XMLFragment("collectionLength", Long.toString(collectionLength)));
 32  0
         processor.process(new XMLFragment("documentCount", Long.toString(documentCount)));
 33  0
         super.close();
 34  0
     }
 35  
 }