Exemplo n.º 1
0
        protected override void VisitExists(ReteBuilderContext context, ExistsElement element)
        {
            BuildSubnet(context, element.ChildElements.Single());
            var betaNode = new ExistsNode(context.BetaSource, context.AlphaSource);

            if (context.HasSubnet)
            {
                betaNode.Conditions.Add(new SubnetCondition());
            }
            context.BetaSource = BuildBetaMemoryNode(context, betaNode);
            context.ResetAlphaSource();
        }
Exemplo n.º 2
0
        private void BuildExistsNode(ReteBuilderContext context, RuleElement element)
        {
            var node = context.AlphaSource
                       .Sinks.OfType <ExistsNode>()
                       .FirstOrDefault(x =>
                                       x.RightSource == context.AlphaSource &&
                                       x.LeftSource == context.BetaSource);

            if (node == null)
            {
                node = new ExistsNode(context.BetaSource, context.AlphaSource);
            }
            node.NodeInfo.Add(context.Rule, element);
            BuildBetaMemoryNode(context, node);
            context.ResetAlphaSource();
        }
Exemplo n.º 3
0
        private void BuildExistsNode(ReteBuilderContext context)
        {
            var node = context.AlphaSource
                       .Sinks.OfType <ExistsNode>()
                       .FirstOrDefault(x =>
                                       x.RightSource == context.AlphaSource &&
                                       x.LeftSource == context.BetaSource);

            if (node == null)
            {
                node = new ExistsNode(context.BetaSource, context.AlphaSource);
                if (context.HasSubnet)
                {
                    node.Conditions.Insert(0, new SubnetCondition());
                }
            }
            BuildBetaMemoryNode(context, node);
            context.ResetAlphaSource();
        }