示例#1
0
        private void BuildBindingNode(ReteBuilderContext context, BindingElement element)
        {
            var node = context.BetaSource
                       .Sinks.OfType <BindingNode>()
                       .FirstOrDefault(x =>
                                       ExpressionComparer.AreEqual(x.BindingExpression.Expression, element.Expression));

            if (node == null)
            {
                var bindingExpression = ExpressionCompiler.CompileBindingExpression(element, context.Declarations);
                node = new BindingNode(bindingExpression, element.ResultType, context.BetaSource);
            }
            BuildBetaMemoryNode(context, node);
            context.ResetAlphaSource();
        }
示例#2
0
        private void BuildBindingNode(ReteBuilderContext context, BindingElement element)
        {
            var node = context.BetaSource
                       .Sinks.OfType <BindingNode>()
                       .FirstOrDefault(x =>
                                       ExpressionElementComparer.AreEqual(x.ExpressionElement, element));

            if (node == null)
            {
                var compiledExpression = ExpressionCompiler.CompileLhsTupleExpression <object>(element, context.Declarations);
                node = new BindingNode(element, compiledExpression, element.ResultType, context.BetaSource);
            }
            node.NodeInfo.Add(context.Rule, element);
            BuildBetaMemoryNode(context, node);
            context.ResetAlphaSource();
        }