本文整理汇总了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);
}
}
示例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);
}
}