com.github.sebhoss.reguloj.LimitedRuleEngine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reguloj Show documentation
Show all versions of reguloj Show documentation
Lightweight business rule engine
The newest version!
/*
* Copyright © 2010 Sebastian Hoß
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
*/
package com.github.sebhoss.reguloj;
import java.util.Collection;
final class LimitedRuleEngine> extends AbstractRuleEngine {
private final int maximumNumberOfRuns;
LimitedRuleEngine(final int maximumNumberOfRuns) {
this.maximumNumberOfRuns = maximumNumberOfRuns;
}
@Override
public void infer(final Collection> rules, final CONTEXT context) {
int currentRuns = 0;
while (analyze(rules, context)) {
performSinglePass(rules, context);
if (++currentRuns >= maximumNumberOfRuns) {
break;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy