/// <summary> /// If businessObjects is Null, this method performs the same operation as the parameterless /// method ; else uses the binder provided in the constructor to perform fact assertions and /// orchestrate the process. /// If businessObjects is not Null and no binder has been provided in the constructor, throws /// a BREException. /// </summary> /// <param name="businessObjects">An Hashtable of business objects, or Null.</param> public void Process(Hashtable businessObjects) { CheckInitialized(); iteration = 0; if (HasLogListener) { ForceDispatchLog("NxBRE Inference Engine Processing Started", LogEventImpl.INFO); } if (businessObjects == null) { InferUntilNoNewFact(new ArrayList()); } else if (Binder == null) { throw new BREException("NxBRE Inference Engine needs a Binder to process business objects"); } else if (Binder.BindingType == BindingTypes.BeforeAfter) { long iniTime = DateTime.Now.Ticks; Binder.BusinessObjects = businessObjects; Binder.BeforeProcess(); if (HasLogListener) { ForceDispatchLog("NxBRE Binder 'BeforeProcess' Done in " + (long)(DateTime.Now.Ticks - iniTime) / 10000 + " milliseconds", LogEventImpl.INFO); } bool binderIterate = true; ArrayList positiveImplications = new ArrayList(); while (binderIterate) { binderIterate = false; InferUntilNoNewFact(positiveImplications); WM.FB.ModifiedFlag = false; iniTime = DateTime.Now.Ticks; Binder.AfterProcess(); binderIterate = WM.FB.ModifiedFlag; if (HasLogListener) { ForceDispatchLog("NxBRE Binder 'AfterProcess' Done in " + (long)(DateTime.Now.Ticks - iniTime) / 10000 + " milliseconds with " + (binderIterate?"":"no ") + "new fact(s) detected", LogEventImpl.INFO); } } // while binderIterate } else if (Binder.BindingType == BindingTypes.Control) { long iniTime = DateTime.Now.Ticks; Binder.BusinessObjects = businessObjects; Binder.ControlProcess(); if (HasLogListener) { ForceDispatchLog("NxBRE Binder 'ControlProcess' Done in " + (long)(DateTime.Now.Ticks - iniTime) / 10000 + " milliseconds", LogEventImpl.INFO); } } else { throw new BREException("Unexpected behaviour: BOs=" + businessObjects + " ; Binder=" + Binder); } if (HasLogListener) { ForceDispatchLog("NxBRE Inference Engine Processing Finished", LogEventImpl.INFO); } }