package uk.ac.ebi.quickgo.index.annotation.coterms;

import com.google.common.base.Preconditions;
import java.util.Iterator;
import org.springframework.batch.item.ItemReader;

/**
 * @author Tony Wardell
 * Date: 07/09/2016
 * Time: 15:38
 * Created with IntelliJ IDEA.
 */
public class CoStatsForTermItemReader implements ItemReader<String>{

    private final CoStatsPermutations coStatsPermutations;
    Iterator<String> termsIt;

    public CoStatsForTermItemReader(CoStatsPermutations coStatsPermutations) {
        this.coStatsPermutations = coStatsPermutations;

    }

    @Override public String read() throws Exception {
        if(termsIt==null) {
            termsIt = coStatsPermutations.getTermToTermOverlapMatrix().keySet().iterator();
        }

        if(termsIt.hasNext()){
            return termsIt.next();
        }

        return null;
    }
}

@@ -50,53 +50,8 @@
 s;%0A%0A
-import com.google.common.base.Preconditions;%0A
 impo
@@ -314,47 +314,63 @@
 nal 
-CoStatsPermutations coStatsPermutations
+AnnotationCoTermsAggregator annotationCoTermsAggregator
 ;%0A  
@@ -438,105 +438,137 @@
 der(
-CoStatsPermutations coStatsPermutations) %7B%0A        this.coStatsPermutations = coStatsPermutations
+AnnotationCoTermsAggregator annotationCoTermsAggregator) %7B%0A        this.annotationCoTermsAggregator = annotationCoTermsAggregator
 ;%0A%0A 
@@ -681,27 +681,35 @@
 t = 
-coStatsPermutations
+annotationCoTermsAggregator
 .get

Rename used classes.