Esempio n. 1
0
        /// <summary>
        /// method for propogating the retract
        /// </summary>
        /// <param name="inx">The inx.</param>
        /// <param name="engine">The engine.</param>
        /// <param name="mem">The mem.</param>
        protected internal virtual void propogateRetract(Index inx, Rete engine, IWorkingMemory mem)
        {
            for (int idx = 0; idx < successorNodes.Length; idx++)
            {
                BaseJoin node = successorNodes[idx] as BaseJoin;
                if (node != null)
                {
                    node.retractLeft(inx, engine, mem);
                }
                else
                {
                    TerminalNode tnode = successorNodes[idx] as TerminalNode;
                    if (tnode != null)
                    {
                        tnode.retractFacts(inx, engine, mem);
                    }
                }


                //BaseNode node = successorNodes[idx];
                //if (node is BaseJoin)
                //{
                //    ((BaseJoin) node).retractLeft(inx, engine, mem);
                //}
                //else if (node is TerminalNode)
                //{
                //    ((TerminalNode) node).retractFacts(inx, engine, mem);
                //}
            }
        }
Esempio n. 2
0
 /// <summary> propogate the retract
 /// 
 /// </summary>
 /// <param name="">fact
 /// </param>
 /// <param name="">engine
 /// 
 /// </param>
 protected internal override void propogateRetract(IFact fact, Rete engine, IWorkingMemory mem)
 {
     for (int idx = 0; idx < successorNodes.Length; idx++)
     {
         BaseNode nNode = successorNodes[idx];
         if (nNode is BaseJoin)
         {
             BaseJoin next = (BaseJoin) nNode;
             IFact[] newf = new IFact[] {fact};
             next.retractLeft(new Index(newf), engine, mem);
         }
         else if (nNode is TerminalNode)
         {
             TerminalNode next = (TerminalNode) nNode;
             IFact[] newf = new IFact[] {fact};
             next.retractFacts(new Index(newf), engine, mem);
         }
     }
 }