jigsaw & test updates
[reguloj.git] / src / main / java / wtf / metio / reguloj / FirstWinsRuleEngine.java
blobecb5c7317bdd0e86c7aec200f79c67e5e6190127
1 package wtf.metio.reguloj;
3 import java.util.Collection;
5 final class FirstWinsRuleEngine<CONTEXT extends Context<?>> extends AbstractRuleEngine<CONTEXT> {
7 @Override
8 public void infer(final Collection<Rule<CONTEXT>> rules, final CONTEXT context) {
9 rules.stream()
10 .filter(rule -> rule.fires(context))
11 .findFirst()
12 .ifPresent(rule -> rule.run(context));