/** * Add a new rule to the rule set. This should only be used by implementations * of RuleProprocessHook (which are called during rule system preparation phase). * If called at other times the rule won't be correctly transferred into the * underlying engines. */ public void addRuleDuringPrepare(Rule rule) { if (rules == rawRules) { // Ensure the original is preserved in case we need to do a restart rules = new ArrayList<>( rawRules ); // if (rawRules instanceof ArrayList) { // rules = (ArrayList<Rule>) ((ArrayList<Rule>)rawRules).clone(); // } else { // rules = new ArrayList<Rule>(rawRules); // } // Rebuild the forward engine to use the cloned rules instantiateRuleEngine(rules); } rules.add(rule); }
/** * Add a new rule to the rule set. This should only be used by implementations * of RuleProprocessHook (which are called during rule system preparation phase). * If called at other times the rule won't be correctly transferred into the * underlying engines. */ public void addRuleDuringPrepare(Rule rule) { if (rules == rawRules) { // Ensure the original is preserved in case we need to do a restart rules = new ArrayList<>( rawRules ); // if (rawRules instanceof ArrayList) { // rules = (ArrayList<Rule>) ((ArrayList<Rule>)rawRules).clone(); // } else { // rules = new ArrayList<Rule>(rawRules); // } // Rebuild the forward engine to use the cloned rules instantiateRuleEngine(rules); } rules.add(rule); }
/** * Cause the inference graph to reconsult both the underlying graph and * the reasoner ruleset, permits the forward rule set to be dynamically changed. * Causes the entire rule engine to be rebuilt from the current ruleset and * reinitialized against the current data. Not needed for normal cases. */ public void rebindAll() { rawRules = ((FBRuleReasoner)reasoner).getRules(); instantiateRuleEngine( rawRules ); rebind(); }
/** * Cause the inference graph to reconsult both the underlying graph and * the reasoner ruleset, permits the forward rule set to be dynamically changed. * Causes the entire rule engine to be rebuilt from the current ruleset and * reinitialized against the current data. Not needed for normal cases. */ public void rebindAll() { rawRules = ((FBRuleReasoner)reasoner).getRules(); instantiateRuleEngine( rawRules ); rebind(); }