2 * This file is part of reguloj. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at https://creativecommons.org/publicdomain/zero/1.0/. No part of reguloj,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
8 package wtf
.metio
.reguloj
;
10 import java
.util
.Collection
;
13 * Chained rule engine that repeatedly runs all rules until no rule fires anymore.
15 * @param <CONTEXT> The type of the context.
16 * @see FirstWinsRuleEngine
17 * @see LimitedRuleEngine
19 final class ChainedRuleEngine
<CONTEXT
extends Context
<?
>> extends AbstractRuleEngine
<CONTEXT
> {
22 public void infer(final Collection
<Rule
<CONTEXT
>> rules
, final CONTEXT context
) {
23 while (analyze(rules
, context
)) {
24 rules
.forEach(rule
-> rule
.run(context
));