Пример #1
0
 private void NegativeNodeRightActivation(Negative_Node node, WME w)
 {
     foreach (Token t in node.Items)
     {
         if (PerformJoinTests(node.Tests, t, w))
         {
             if (t.Join_Results.Count == 0)
             {
                 DeleteDescendentsOfToken(t);
             }
             Negative_Join_Result jr = new Negative_Join_Result();
             jr.Owner = t;
             jr.WME   = w;
             t.Join_Results.Insert(0, jr);
             w.Negative_Join_Results.Insert(0, jr);
         }
     }
 }
Пример #2
0
        // for supporting negated conditions

        private void NegativeNodeLeftActivation(Negative_Node node, Token t, WME w)
        {
            // build and store a new token, just like a beta memory would
            Token new_token = Make_Token(node, t, w);

            node.Items.Insert(0, new_token);

            // compute the join results
            new_token.Join_Results.Clear();
            foreach (WME item in node.Amem.Items)
            {
                if (PerformJoinTests(node.Tests, new_token, item))
                {
                    Negative_Join_Result jr = new Negative_Join_Result();
                    jr.Owner = new_token;
                    jr.WME   = w;
                    new_token.Join_Results.Insert(0, jr);
                    if (w != null)
                    {
                        w.Negative_Join_Results.Insert(0, jr);
                    }
                }
            }

            // if join results is empty, then inform children
            if (new_token.Join_Results.Count == 0)
            {
                foreach (ReteNode child in node.Children)
                {
                    //Beta_Memory_Left_Activation((Beta_Memory)child, new_token, null);

                    // foamliu, 2008/08/26, use a general method here
                    // to support both join-node and negative-node.
                    LeftActivation(child, new_token, null);
                }
            }
        }