public override void compileSingleCE(Rule.IRule rule)
        {
            ICondition[]    conds = rule.Conditions;
            ObjectCondition oc    = (ObjectCondition)conds[0];

            if (oc.Negated)
            {
                // the ObjectCondition is negated, so we need to
                // handle it appropriate. This means we need to
                // Add a LIANode to _IntialFact and attach a NOTNode
                // to the LIANode.
                ObjectTypeNode otn     = (ObjectTypeNode)ruleCompiler.Inputnodes.Get(ruleCompiler.Engine.InitFact);
                LIANode        lianode = ruleCompiler.findLIANode(otn);
                NotJoinFrst    njoin   = new NotJoinFrst(ruleCompiler.Engine.nextNodeId());
                njoin.Bindings = new Binding[0];
                lianode.addSuccessorNode(njoin, ruleCompiler.Engine, ruleCompiler.Memory);
                // Add the join to the rule object
                rule.addJoinNode(njoin);
                oc.LastNode.addSuccessorNode(njoin, ruleCompiler.Engine, ruleCompiler.Memory);
            }
            else if (oc.Nodes.Count == 0)
            {
                // this means the rule has a binding, but no conditions
                ObjectTypeNode otn = ruleCompiler.findObjectTypeNode(oc.TemplateName);
                //HACK TODO
                if (otn != null)
                {
                    LIANode lianode = new LIANode(ruleCompiler.Engine.nextNodeId());
                    otn.addSuccessorNode(lianode, ruleCompiler.Engine, ruleCompiler.Memory);
                    rule.Conditions[0].addNode(lianode);
                }
            }
        }
Exemple #2
0
 public override void compileSingleCE(Rule.IRule rule)
 {
     ICondition[] conds = rule.Conditions;
     ObjectCondition oc = (ObjectCondition) conds[0];
     if (oc.Negated)
     {
         // the ObjectCondition is negated, so we need to
         // handle it appropriate. This means we need to
         // Add a LIANode to _IntialFact and attach a NOTNode
         // to the LIANode.
         ObjectTypeNode otn = (ObjectTypeNode) ruleCompiler.Inputnodes.Get(ruleCompiler.Engine.InitFact);
         LIANode lianode = ruleCompiler.findLIANode(otn);
         NotJoinFrst njoin = new NotJoinFrst(ruleCompiler.Engine.nextNodeId());
         njoin.Bindings = new Binding[0];
         lianode.addSuccessorNode(njoin, ruleCompiler.Engine, ruleCompiler.Memory);
         // Add the join to the rule object
         rule.addJoinNode(njoin);
         oc.LastNode.addSuccessorNode(njoin, ruleCompiler.Engine, ruleCompiler.Memory);
     }
     else if (oc.Nodes.Count == 0)
     {
         // this means the rule has a binding, but no conditions
         ObjectTypeNode otn = ruleCompiler.findObjectTypeNode(oc.TemplateName);
         //HACK TODO
         if(otn != null)
         {
             LIANode lianode = new LIANode(ruleCompiler.Engine.nextNodeId());
             otn.addSuccessorNode(lianode, ruleCompiler.Engine, ruleCompiler.Memory);
             rule.Conditions[0].addNode(lianode);
         }
     }
 }