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

import uk.ac.ebi.quickgo.index.annotation.Annotation;

import com.google.common.base.Preconditions;
import java.util.function.Predicate;
import org.springframework.batch.item.ItemProcessor;

/**
 * @author Tony Wardell
 * Date: 06/09/2016
 * Time: 16:30
 * Created with IntelliJ IDEA.
 *
 * A version of ItemProcessor for adding details from an {@link uk.ac.ebi.quickgo.index.annotation.Annotation}
 * to a matrix of permutations where GOTerm A and GOTerm B both annotate the same Gene Product.
 *
 * Version of GPAFileToSummary from Beta
 */
public class Co_occurringGoTermsFromAnnotations implements ItemProcessor<Annotation, Annotation> {

    private final AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator;
    private final Predicate<Annotation> toBeProcessed;

    public Co_occurringGoTermsFromAnnotations(AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator,
            Predicate<Annotation> toBeProcessed) {
        Preconditions.checkArgument(annotationCoOccurringTermsAggregator != null);
        Preconditions.checkArgument(toBeProcessed != null);
        this.annotationCoOccurringTermsAggregator = annotationCoOccurringTermsAggregator;
        this.toBeProcessed = toBeProcessed;
    }

    @Override
    public Annotation process(Annotation annotation) throws Exception {

        if (toBeProcessed.test(annotation)) {
            annotationCoOccurringTermsAggregator.addRowToMatrix(annotation);
        }

        return annotation;
    }
}

@@ -750,34 +750,8 @@
 or a
-nnotationCoOccurringTermsA
 ggre
@@ -902,34 +902,8 @@
 or a
-nnotationCoOccurringTermsA
 ggre
@@ -1001,34 +1001,8 @@
 nt(a
-nnotationCoOccurringTermsA
 ggre
@@ -1095,73 +1095,21 @@
 is.a
-nnotationCoOccurringTermsAggregator = annotationCoOccurringTermsA
+ggregator = a
 ggre
@@ -1252,17 +1252,16 @@
 ption %7B%0A
-%0A
         
@@ -1315,34 +1315,8 @@
    a
-nnotationCoOccurringTermsA
 ggre
@@ -1355,25 +1355,24 @@
 ;%0A        %7D%0A
-%0A
         retu

Rename AnnotationCo_occurringTermsAggregator member variable to something more usable.