public void BasicObjectBindingTest1() { long ts = DateTime.Now.Ticks; int fired = 0; int activations = 0; Basic basic = new Basic("one", 1); using (TextWriter writer = Console.Out) { Rete engine = new Rete(); engine.Watch = WatchType.WATCH_ALL; engine.addPrintWriter("Console", writer); engine.declareObject(typeof (Basic), "Basic"); engine.loadRuleset(getRule3()); foreach (Defrule rule in engine.CurrentFocus.AllRules) { Console.WriteLine(rule.toPPString()); } engine.assertObject(basic, "Basic", false, false); activations = engine.CurrentFocus.ActivationCount; fired = engine.fire(); engine.printWorkingMemory(true, false); double endTime = DateTime.Now.Ticks - ts; Console.WriteLine(String.Format("BasicObjectBindingTest1 completed in {0} seconds.", (endTime/10000000).ToString("0.000000"))); writer.Flush(); writer.Close(); engine.close(); } Assert.IsTrue(fired == 1); Assert.IsTrue(activations == 1); //AppDomain.Unload(AppDomain.CurrentDomain); }
/// <summary> NotJoin has to have a special addSuccessorNode since it needs /// to just propogate the left facts if it has zero matches. /// </summary> public override void addSuccessorNode(TerminalNode node, Rete engine, IWorkingMemory mem) { if (addNode(node)) { // first, we Get the memory for this node IGenericMap<Object, Object> leftmem = (IGenericMap<Object, Object>) mem.getBetaLeftMemory(this); // now we iterate over the entry set IEnumerator itr = leftmem.Values.GetEnumerator(); while (itr.MoveNext()) { Object omem = itr.Current; if (omem is IBetaMemory) { IBetaMemory bmem = (IBetaMemory) omem; EqHashIndex inx = new EqHashIndex(NodeUtils.getLeftValues(binds, bmem.LeftFacts)); HashedAlphaMemoryImpl rightmem = (HashedAlphaMemoryImpl) mem.getBetaRightMemory(this); // we don't bother adding the right fact to the left, since // the right side is already Hashed if (rightmem.count(inx) == 0) { node.assertFacts(bmem.Index, engine, mem); } } } } }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { bool bound = false; if (params_Renamed.Length == 2) { String name = params_Renamed[0].StringValue; Object val = null; if (params_Renamed[1] is ValueParam) { val = params_Renamed[1].Value; } else if (params_Renamed[1] is FunctionParam2) { FunctionParam2 fp2 = (FunctionParam2) params_Renamed[1]; fp2.Engine = engine; fp2.lookUpFunction(); DefaultReturnVector drv = (DefaultReturnVector) fp2.Value; val = drv.firstReturnValue().Value; } engine.setBindingValue(name, val); bound = true; } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, bound); ret.addReturnValue(rv); return ret; }
/// <summary> /// </summary> /// <param name="">cond /// </param> /// <param name="">templ /// </param> /// <param name="">engine /// </param> /// <returns> /// /// </returns> public static IFact generateDeffact(ObjectCondition cond, Deftemplate templ, Rete.Rete engine) { List<object> list = new List<Object>(); IConstraint[] cnstr = cond.Constraints; for (int idx = 0; idx < cnstr.Length; idx++) { IConstraint cn = cnstr[idx]; if (cn is LiteralConstraint) { Slot s = new Slot(cn.Name, cn.Value); list.Add(s); } else if (cn is PredicateConstraint) { PredicateConstraint pc = (PredicateConstraint) cn; Object val = generatePredicateValue(pc); Slot s = new Slot(cn.Name, val); list.Add(s); } else if (cn is BoundConstraint) { // for now we do the simple thing and just set // any bound slots to 1 Slot s = new Slot(cn.Name, 1); list.Add(s); } } IFact f = templ.createFact(list, engine.nextFactId()); return f; }
public void ObjectBindingTest1() { long ts = DateTime.Now.Ticks; int fired = 0; int activations = 0; using (TextWriter writer = Console.Out) { Rete engine = new Rete(); engine.Watch = WatchType.WATCH_ALL; engine.addPrintWriter("Console", writer); engine.declareObject(typeof (Account), "Account"); engine.loadRuleset(getRule1()); engine.assertObject(GetAcct0(), "Account", false, false); activations = engine.CurrentFocus.ActivationCount; fired = engine.fire(); engine.printWorkingMemory(true, false); double endTime = DateTime.Now.Ticks - ts; Console.WriteLine(String.Format("ObjectBindingTest1 completed in {0} seconds.", (endTime/10000000).ToString("0.000000"))); writer.Flush(); writer.Close(); engine.close(); } Assert.IsTrue(fired == 1); Assert.IsTrue(activations == 1); //AppDomain.Unload(AppDomain.CurrentDomain); }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { bool eval = false; if (params_Renamed.Length == 2) { Object param1 = null; if (params_Renamed[0] is BoundParam && params_Renamed[1] is BoundParam) { param1 = ((BoundParam) params_Renamed[0]).ObjectRef; try { Type clazz = classnameResolver.resolveClass(((BoundParam) params_Renamed[1]).StringValue); eval = clazz.IsInstanceOfType(param1); } catch (Exception e) { throw new RuntimeException(e); } } } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, eval); ret.addReturnValue(rv); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { DefaultReturnVector ret = new DefaultReturnVector(); int index = - 1; if (params_Renamed != null && params_Renamed.Length == 2) { Object first = params_Renamed[0].Value; Object[] second = (Object[]) params_Renamed[1].Value; for (int idx = 0; idx < second.Length; idx++) { if (first.Equals(second[idx])) { index = idx; break; } } } if (index > - 1) { DefaultReturnValue rv = new DefaultReturnValue(Constants.INTEGER_OBJECT, index); ret.addReturnValue(rv); } else { DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, false); ret.addReturnValue(rv); } return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { double dval = 0; if (params_Renamed != null) { if (params_Renamed.Length == 1) { if (params_Renamed[0] is ValueParam) { ValueParam n = (ValueParam) params_Renamed[0]; dval = n.DoubleValue; dval = System.Math.Cos(dval); } else if (params_Renamed[0] is BoundParam) { BoundParam bp = (BoundParam) params_Renamed[0]; dval = bp.DoubleValue; dval = System.Math.Cos(dval); } else if (params_Renamed[0] is FunctionParam2) { FunctionParam2 n = (FunctionParam2) params_Renamed[0]; n.Engine = engine; n.lookUpFunction(); IReturnVector rval = (IReturnVector) n.Value; dval = rval.firstReturnValue().DoubleValue; dval = System.Math.Cos(dval); } } } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.DOUBLE_PRIM_TYPE, dval); ret.addReturnValue(rv); return ret; }
/* static DefaultRuleCompiler() { FUNCTION_NOT_FOUND = Messages.getString("CompilerProperties_function_not_found"); INVALID_FUNCTION = Messages.getString("CompilerProperties_invalid_function"); ASSERT_ON_PROPOGATE = Messages.getString("CompilerProperties_assert_on_Add"); } */ public DefaultRuleCompiler(Rete engine, IGenericMap<object, object> inputNodes) { InitBlock(); this.engine = engine; this.inputnodes = inputNodes; tval = new TemplateValidation(engine); }
/// <summary> Assert from the right side is always going to be from an Alpha node. /// /// </summary> /// <param name="">factInstance /// </param> /// <param name="">engine /// /// </param> public override void assertRight(IFact rfact, Rete engine, IWorkingMemory mem) { // Get the memory for the node HashedNeqAlphaMemory rightmem = (HashedNeqAlphaMemory) mem.getBetaRightMemory(this); NotEqHashIndex inx = new NotEqHashIndex(NodeUtils.getRightBindValues(binds, rfact)); rightmem.addPartialMatch(inx, rfact); bool zm = rightmem.zeroMatch(inx); IGenericMap<Object, Object> leftmem = (IGenericMap<Object, Object>) mem.getBetaLeftMemory(this); IEnumerator itr = leftmem.Values.GetEnumerator(); while (itr.MoveNext()) { Index linx = (Index) itr.Current; if (evaluate(linx.Facts, rfact)) { if (!zm) { try { propogateRetract(linx, engine, mem); } catch (RetractException e) { throw new AssertException("NotJion - " + e.Message); } } } } }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { int count = 0; if (params_Renamed != null && params_Renamed.Length == 1) { int fc = params_Renamed[0].IntValue; try { count = engine.fire(fc); } catch (ExecuteException e) { Trace.WriteLine(e.Message); } } else { count = engine.fire(); } // engine.writeMessage(String.valueOf(count) + Constants.LINEBREAK,"t"); DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.INTEGER_OBJECT, count); ret.addReturnValue(rv); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { String asrt = ""; if (params_Renamed.Length >= 1 && params_Renamed[0].Value != null) { Object obj = params_Renamed[0].Value; String template = ""; if (params_Renamed.Length == 2 && params_Renamed[1].StringValue != null) { template = params_Renamed[1].StringValue; } try { engine.assertObject(obj, template, false, true); asrt = "true"; } catch (AssertException e) { // we should log this and output an error asrt = "false"; } } else { asrt = "false"; } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.STRING_TYPE, asrt); ret.addReturnValue(rv); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { Decimal bdval = new Decimal(0); Decimal bd = new Decimal(0); if (params_Renamed != null) { for (int idx = 0; idx < params_Renamed.Length; idx++) { if (params_Renamed[idx] is ValueParam) { ValueParam n = (ValueParam) params_Renamed[idx]; bdval = n.BigDecimalValue; } else if (params_Renamed[idx] is BoundParam) { BoundParam bp = (BoundParam) params_Renamed[idx]; bdval = (Decimal) engine.getBinding(bp.VariableName); } else if (params_Renamed[idx] is FunctionParam2) { FunctionParam2 n = (FunctionParam2) params_Renamed[idx]; n.Engine = engine; n.lookUpFunction(); IReturnVector rval = (IReturnVector) n.Value; bdval = rval.firstReturnValue().BigDecimalValue; } double bdh = System.Math.Pow(System.Math.E, Decimal.ToDouble(bdval)); bdval = new Decimal(bdh); } } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BIG_DECIMAL, bdval); ret.addReturnValue(rv); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { bool removed = true; if (params_Renamed.Length == 1) { String rl = params_Renamed[0].StringValue; Defrule defrl = (Defrule) engine.CurrentFocus.findRule(rl); if (defrl != null) { engine.CurrentFocus.removeRule(defrl, engine, engine.WorkingMemory); } else { removed = false; } } else { removed = false; } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, removed); ret.addReturnValue(rv); return ret; }
public void testFiveRules() { int objCount = 25000; Random ran = new Random(); ArrayList facts = new ArrayList(); // loop and create account and transaction objects for (int idx = 0; idx < objCount; idx++) { Account4 acc = new Account4(); acc.AccountId = "acc" + idx; acc.AccountType = Convert.ToString(ran.Next(100000)); acc.First = Convert.ToString(ran.Next(100000)); acc.Last = Convert.ToString(ran.Next(100000)); acc.Middle = Convert.ToString(ran.Next(100000)); acc.Status = Convert.ToString(ran.Next(100000)); acc.Title = Convert.ToString(ran.Next(100000)); acc.Username = Convert.ToString(ran.Next(100000)); acc.CountryCode = "US"; acc.Cash = 1298.00; facts.Add(acc); Transaction tx = new Transaction(); tx.AccountId = "acc" + idx; tx.Total = 1200000; facts.Add(tx); } Console.WriteLine("created " + objCount + " Accounts and Transactions"); Rete engine = new Rete(); engine.declareObject(typeof (Account4)); engine.declareObject(typeof (Transaction)); Console.WriteLine("delcare the objects"); engine.close(); }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { bool boolVal = true; if (params_Renamed != null) { if (params_Renamed.Length == 1) { if (params_Renamed[0] is ValueParam) { ValueParam n = (ValueParam) params_Renamed[0]; boolVal = n.BooleanValue; } else if (params_Renamed[0] is BoundParam) { BoundParam bp = (BoundParam) params_Renamed[0]; boolVal = ((Boolean) engine.getBinding(bp.VariableName)); } else if (params_Renamed[0] is FunctionParam2) { FunctionParam2 n = (FunctionParam2) params_Renamed[0]; n.Engine = engine; n.lookUpFunction(); IReturnVector rval = (IReturnVector) n.Value; boolVal = rval.firstReturnValue().BooleanValue; } boolVal = (boolVal == false); } } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, boolVal); ret.addReturnValue(rv); return ret; }
/// <summary> the function will printout one or more templates. This implementation /// is slightly different than CLIPS in that it can take one or more /// template names. The definition in CLIPS beginners guide states the /// function does the following: (ppdeftemplate <deftemplate-name>) /// </summary> public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { GenericHashMap<object, object> filter = new GenericHashMap<object, object>(); if (params_Renamed != null && params_Renamed.Length > 0) { for (int idx = 0; idx < params_Renamed.Length; idx++) { if (params_Renamed[idx] is ValueParam) { Object df = ((ValueParam) params_Renamed[idx]).Value; filter.Put(df, df); } } } List<Object> templ = (List<Object>) engine.CurrentFocus.Templates; IEnumerator itr = templ.GetEnumerator(); while (itr.MoveNext()) { ITemplate tp = (ITemplate) itr.Current; if (filter.Get(tp.Name) != null) { engine.writeMessage(tp.toPPString() + "\r\n", "t"); } } return new DefaultReturnVector(); }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { if (params_Renamed != null && params_Renamed.Length > 0) { for (int idx = 0; idx < params_Renamed.Length; idx++) { if (params_Renamed[idx].StringValue.Equals("all")) { engine.Profile = ProfileType.PROFILE_ALL; } else if (params_Renamed[idx].StringValue.Equals("assert-fact")) { engine.Profile = ProfileType.PROFILE_ASSERT; } else if (params_Renamed[idx].StringValue.Equals("Add-activation")) { engine.Profile = ProfileType.PROFILE_ADD_ACTIVATION; } else if (params_Renamed[idx].StringValue.Equals("fire")) { engine.Profile = ProfileType.PROFILE_FIRE; } else if (params_Renamed[idx].StringValue.Equals("retract-fact")) { engine.Profile = ProfileType.PROFILE_RETRACT; } else if (params_Renamed[idx].StringValue.Equals("Remove-activation")) { engine.Profile = ProfileType.PROFILE_RM_ACTIVATION; } } } DefaultReturnVector ret = new DefaultReturnVector(); return ret; }
public override void assertLeft(Index linx, Rete engine, IWorkingMemory mem) { long time = RightTime; IGenericMap<Object, Object> leftmem = (IGenericMap<Object, Object>) mem.getBetaLeftMemory(this); leftmem.Put(linx, linx); EqHashIndex inx = new EqHashIndex(NodeUtils.getLeftValues(binds, linx.Facts)); TemporalHashedAlphaMem rightmem = (TemporalHashedAlphaMem) mem.getBetaRightMemory(this); IEnumerator itr = rightmem.iterator(inx); if (itr != null) { try { while (itr.MoveNext()) { IFact vl = (IFact) itr.Current; if (vl != null) { if (vl.timeStamp() > time) { propogateAssert(linx.add(vl), engine, mem); } else { rightmem.removePartialMatch(inx, vl); propogateRetract(linx.add(vl), engine, mem); } } } } catch (RetractException e) { // there shouldn't be any retract exceptions } } }
public override void assertRight(IFact rfact, Rete engine, IWorkingMemory mem) { long time = LeftTime; TemporalHashedAlphaMem rightmem = (TemporalHashedAlphaMem) mem.getBetaRightMemory(this); EqHashIndex inx = new EqHashIndex(NodeUtils.getRightValues(binds, rfact)); rightmem.addPartialMatch(inx, rfact); // now that we've added the facts to the list, we // proceed with evaluating the fact IGenericMap<Object, Object> leftmem = (IGenericMap<Object, Object>) mem.getBetaLeftMemory(this); // since there may be key collisions, we iterate over the // values of the HashMap. If we used keySet to iterate, // we could encounter a ClassCastException in the case of // key collision. IEnumerator itr = leftmem.Values.GetEnumerator(); try { while (itr.MoveNext()) { Index linx = (Index) itr.Current; if (evaluate(linx.Facts, rfact, time)) { // now we propogate propogateAssert(linx.add(rfact), engine, mem); } else { propogateRetract(linx.add(rfact), engine, mem); } } } catch (RetractException e) { // we shouldn't Get a retract exception. if we do, it's a bug } }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, true); ret.addReturnValue(rv); return ret; }
public virtual void loadFunctions(Rete engine) { StringCompareFunction compare = new StringCompareFunction(); engine.declareFunction(compare); funcs.Add(compare); StringIndexFunction indx = new StringIndexFunction(); engine.declareFunction(indx); funcs.Add(indx); StringLengthFunction strlen = new StringLengthFunction(); engine.declareFunction(strlen); funcs.Add(strlen); StringLowerFunction lower = new StringLowerFunction(); engine.declareFunction(lower); funcs.Add(lower); StringReplaceFunction strrepl = new StringReplaceFunction(); engine.declareFunction(strrepl); funcs.Add(strrepl); StringUpperFunction upper = new StringUpperFunction(); engine.declareFunction(upper); funcs.Add(upper); SubStringFunction sub = new SubStringFunction(); engine.declareFunction(sub); funcs.Add(sub); StringTrimFunction trim = new StringTrimFunction(); engine.declareFunction(trim); funcs.Add(trim); }
public void testAssertWithInterface() { Console.WriteLine("-----------------------------"); Console.WriteLine("start testAssertWithInterface"); Rete engine = new Rete(); engine.declareObject(typeof (IAccount), "account"); Assert.IsNotNull(engine); Account acc1 = new Account(); acc1.AccountId = "1234"; acc1.AccountType = "new"; acc1.First = "fName"; acc1.Last = "lName"; acc1.Middle = "m"; acc1.OfficeCode = "MA"; acc1.RegionCode = "NE"; acc1.Status = "active"; acc1.Title = "MR"; acc1.Username = "******"; try { engine.assertObject(acc1, "account", false, true); Assert.IsTrue(true); Assert.AreEqual(1, engine.ObjectCount); Console.WriteLine("Number of facts: " + engine.ObjectCount); engine.printWorkingMemory(true, true); } catch (AssertException e) { Console.WriteLine(e.Message); } engine.close(); }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { Decimal bdval = new Decimal(0); if (params_Renamed != null) { if (params_Renamed[0] is ValueParam) { ValueParam n = (ValueParam) params_Renamed[0]; bdval = n.BigDecimalValue; } else if (params_Renamed[0] is BoundParam) { BoundParam bp = (BoundParam) params_Renamed[0]; bdval = (Decimal) engine.getBinding(bp.VariableName); } else if (params_Renamed[0] is FunctionParam2) { FunctionParam2 n = (FunctionParam2) params_Renamed[0]; n.Engine = engine; n.lookUpFunction(); IReturnVector rval = (IReturnVector) n.Value; bdval = rval.firstReturnValue().BigDecimalValue; } double bdh = Decimal.ToDouble(bdval); bdval = Convert.ToDecimal(bdh/57.29578); } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BIG_DECIMAL, bdval); ret.addReturnValue(rv); return ret; }
/// <summary> Set the Current node in the sequence of 1-input nodes. /// The Current node can be an AlphaNode or a LIANode. /// </summary> /// <param name="">node /// /// </param> public override void addSuccessorNode(BaseNode node, Rete engine, IWorkingMemory mem) { if (addNode(node)) { // if there are matches, we propogate the facts to // the new successor only IAlphaMemory alpha = (IAlphaMemory) mem.getAlphaMemory(this); if (alpha.size() > 0) { IEnumerator itr = alpha.GetEnumerator(); while (itr.MoveNext()) { if (node is BaseAlpha) { BaseAlpha next = (BaseAlpha) node; next.assertFact((IFact) itr.Current, engine, mem); } else if (node is BaseJoin) { BaseJoin next = (BaseJoin) node; Index inx = new Index(new IFact[] {(IFact) itr.Current}); next.assertLeft(inx, engine, mem); } } } } }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { bool def = true; if (params_Renamed.Length >= 0) { String clazz = params_Renamed[0].StringValue; String template = null; if (params_Renamed[1] != null) { template = params_Renamed[1].StringValue; } String parent = null; if (params_Renamed.Length == 3) { parent = params_Renamed[2].StringValue; } try { engine.declareObject(clazz, template, parent); } catch (Exception e) { def = false; } } else { def = false; } DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, def); ret.addReturnValue(rv); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { if (params_Renamed != null && params_Renamed.Length > 0) { FileInfo dir = new FileInfo(params_Renamed[0].StringValue); if (Directory.Exists(dir.FullName)) { FileInfo[] files = dir.Directory.GetFiles(); for (int idx = 0; idx < files.Length; idx++) { if (Directory.Exists(files[idx].FullName)) { engine.writeMessage("d " + files[idx] + Constants.LINEBREAK); } else { engine.writeMessage("- " + files[idx] + Constants.LINEBREAK); } } engine.writeMessage(files.Length + " files in the directory" + Constants.LINEBREAK, "t"); } else { } } DefaultReturnVector ret = new DefaultReturnVector(); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { Process rt = Process.GetCurrentProcess(); long total = GC.GetTotalMemory(false); engine.writeMessage("Total memory " + (total/1024).ToString() + "Kb | " + (total/1024/1024).ToString() + "Mb" + Constants.LINEBREAK, "t"); DefaultReturnVector ret = new DefaultReturnVector(); return ret; }
public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed) { double dval = _random.NextDouble(); DefaultReturnVector ret = new DefaultReturnVector(); DefaultReturnValue rv = new DefaultReturnValue(Constants.DOUBLE_PRIM_TYPE, dval); ret.addReturnValue(rv); return ret; }
/// <summary> /// The constructor for a message router. /// </summary> /// <param name="engine">The engine.</param> public MessageRouter(Rete.Rete engine) { InitBlock(); this.engine = engine; interpreter = new CLIPSInterpreter(engine); commandThread = new CommandThread(this); commandThread.Start(); }