package com.grayben.riskExtractor.htmlScorer.nodeVisitor.setup.annotation;

import com.grayben.riskExtractor.htmlScorer.nodeVisitor.setup.ElementListSupplier;
import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import org.jsoup.nodes.Element;

import java.util.Set;
import java.util.function.Function;

/**
 * Created by Ben Gray on 17/02/2016.
 */
public class AnnotatedElementFunction implements Function<Set<Scorer<Element>>, AnnotatedElement> {

    @Override
    public AnnotatedElement apply(Set<Scorer<Element>> scorers) {

        return new AnnotatedElement.TreeAssembler(
                new ElementListSupplier(scorers).get(),
                scorers
        ).getRootAnnotation();
    }
}

@@ -306,16 +306,52 @@
 unction;
+%0Aimport java.util.function.Supplier;
 %0A%0A/**%0A *
@@ -448,16 +448,25 @@
 unction%3C
+Supplier%3C
 Set%3CScor
@@ -477,16 +477,17 @@
 lement%3E%3E
+%3E
 , Annota
@@ -549,16 +549,25 @@
 t apply(
+Supplier%3C
 Set%3CScor
@@ -578,24 +578,25 @@
 lement%3E%3E
+%3E
  scorers
 ) %7B%0A%0A   
@@ -587,16 +587,24 @@
  scorers
+Supplier
 ) %7B%0A%0A   
@@ -698,16 +698,30 @@
 (scorers
+Supplier.get()
 ).get(),
@@ -744,16 +744,30 @@
  scorers
+Supplier.get()
 %0A       

Use a supplier