/// <summary> /// Determines if this expression returns true /// </summary> public override void Fire() { if (_ruleToFire == null) { if (_rules.ContainsKey(_ruleId)) { _ruleToFire = _rules[_ruleId]; } else { throw new Exception(string.Format( "'{0}' Rule ID was not found", _ruleId )); } } Debug.WriteLine(string.Format("A: Fire-Rule {0}", _ruleToFire.ID)); _ruleToFire.Fire(_rule.Engine); }
/// <summary> /// Run the engine /// </summary> public void Infer(Engine engine) { if (!engine.HasCompiledEngine) { throw new Exception("Inference Engine cannot run because the Main Rule Engine has not been compiled"); } _executionList = new ExecutionList(this, engine); while (!engine.IsStopped && _executionList.Count > 0) { Rule rule = _executionList.Pop(); Debug.WriteLine(""); Debug.WriteLine(string.Format("Running Rule {0}", rule.ID)); Debug.Indent(); Debug.WriteLine(string.Format("List: {0}", _executionList.ToString())); rule.Fire(engine); Debug.Unindent(); Debug.WriteLine(string.Format("End Run : {0}", rule.ID)); } }