当前位置: 首页>>代码示例>>C#>>正文


C# Rule.addJoinNode方法代码示例

本文整理汇总了C#中Rule.addJoinNode方法的典型用法代码示例。如果您正苦于以下问题:C# Rule.addJoinNode方法的具体用法?C# Rule.addJoinNode怎么用?C# Rule.addJoinNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rule的用法示例。


在下文中一共展示了Rule.addJoinNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: compileJoins

        /// <summary>
        /// Compiles the joins.
        /// </summary>
        /// <param name="rule">The rule.</param>
        public virtual void compileJoins(Rule.IRule rule)
        {
            ICondition[] conds = rule.Conditions;
            BaseJoin prevJoinNode = null;
            BaseJoin joinNode = null;
            ICondition prevCE = null;
            // only if there's more than 1 condition do we attempt to
            // create the join nodes. A rule with just 1 condition has
            // no joins
            if (conds.Length > 1)
            {
                // previous Condition
                prevCE = conds[0];
                //this.compileFirstJoin(engine, memory); moved to the ConditionCompiler.compileFirstJoin method
                prevCE.getCompiler(this).compileFirstJoin(prevCE, rule);

                // now compile the remaining conditions
                for (int idx = 1; idx < conds.Length; idx++)
                {
                    ICondition cdt = conds[idx];

                    joinNode = cdt.getCompiler(this).compileJoin(cdt, idx, rule);
                    cdt.getCompiler(this).connectJoinNode(prevCE, cdt, prevJoinNode, joinNode);

                    // now we set the previous node to current
                    prevCE = cdt;
                    prevJoinNode = joinNode;
                    rule.addJoinNode(joinNode);
                }
            }
            else if (conds.Length == 1)
            {
                conds[0].getCompiler(this).compileSingleCE(rule);
            }
        }
开发者ID:,项目名称:,代码行数:39,代码来源:

示例2: compileSingleCE

 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);
         NotJoin njoin = new NotJoin(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);
         LIANode lianode = new LIANode(ruleCompiler.Engine.nextNodeId());
         otn.addSuccessorNode(lianode, ruleCompiler.Engine, ruleCompiler.Memory);
         rule.Conditions[0].addNode(lianode);
     }
 }
开发者ID:,项目名称:,代码行数:28,代码来源:


注:本文中的Rule.addJoinNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。