<commit_before>package uk.ac.ebi.quickgo.index.annotation.coterms;

import java.util.Iterator;
import org.springframework.batch.item.ItemReader;

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

    private final AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator;
    private Iterator<String> termsIt;

    public Co_occurringTermItemReader(AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator) {
        this.annotationCoOccurringTermsAggregator = annotationCoOccurringTermsAggregator;

    }

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

        if (termsIt.hasNext()) {
            return termsIt.next();
        }<commit_msg>Add some javadoc, notes and use a nicer name for AnnotationCo_occurringTermsAggregator.<commit_after>package uk.ac.ebi.quickgo.index.annotation.coterms;

import java.util.Iterator;
import org.springframework.batch.item.ItemReader;

/**
 * Provide a list of all GO Terms for which co-occurrence has been determined ( which is all of them that have been
 * processed, since at worst a GO Term will have a statistic for co-occurring with itself).
 *
 * @author <NAME>
 * Date: 07/09/2016
 * Time: 15:38
 * Created with IntelliJ IDEA.
 */
class Co_occurringTermItemReader implements ItemReader<String> {

    private final AnnotationCo_occurringTermsAggregator aggregator;
    private Iterator<String> termsIt;

    public Co_occurringTermItemReader(AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator) {
        this.aggregator = annotationCoOccurringTermsAggregator;

    }

    @Override public String read() throws Exception {

        //Delay providing full list until aggregator has fully processed all records.
        if (termsIt == null) {
            termsIt = aggregator.getTermToTermOverlapMatrix().keySet().iterator();
        }

        if (termsIt.hasNext()) {
            return termsIt.next();
        }
{'fraction_non_alphanumeric': 0.0815018315018315, 'fraction_numerical': 0.01098901098901099, 'mean_word_length': 3.9101123595505616, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '685106', 'n_tokens_mistral': 668, 'n_tokens_neox': 619, 'n_words': 151}