package rapanui.core;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

public class AggregateJustificationFinder implements JustificationFinder {
	private final List<JustificationFinder> finders = new LinkedList<JustificationFinder>();

	public AggregateJustificationFinder() {}

	public AggregateJustificationFinder(Collection<? extends JustificationFinder> finders) {
		this();
		this.finders.addAll(finders);
	}

	@Override
	public Emitter<Justification> justifyAsync(ProofEnvironment environment, JustificationRequest request, int recursionDepth) {
		return Emitter.combine(
			finders.stream()
			.map(finder -> finder.justifyAsync(environment, request, recursionDepth))
			.collect(Collectors.toList())
		);
	}
}

@@ -479,16 +479,109 @@
 s);%0A%09%7D%0A%0A
+%09public void addJustificationFinder(JustificationFinder finder) %7B%0A%09%09finders.add(finder);%0A%09%7D%0A%0A
 %09@Overri

allow adding finders after construction