Esempio n. 1
0
        public void PropagateRetract(IExecutionContext context, List <Fact> facts)
        {
            IAlphaMemory memory    = context.WorkingMemory.GetNodeMemory(this);
            var          toRetract = new List <Fact>(facts.Count);

            using (var counter = PerfCounter.Retract(context, this))
            {
                foreach (var fact in facts)
                {
                    if (memory.Contains(fact))
                    {
                        toRetract.Add(fact);
                    }
                }

                counter.AddInputs(facts.Count);
                counter.AddOutputs(toRetract.Count);
            }

            if (toRetract.Count > 0)
            {
                foreach (var sink in _sinks)
                {
                    sink.PropagateRetract(context, toRetract);
                }

                using (var counter = PerfCounter.Retract(context, this))
                {
                    memory.Remove(toRetract);
                    counter.SetCount(memory.FactCount);
                }
            }
        }
Esempio n. 2
0
        public void PropagateRetract(IExecutionContext context, Fact fact)
        {
            IAlphaMemory memory = context.WorkingMemory.GetNodeMemory(this);

            foreach (var sink in _sinks)
            {
                sink.PropagateRetract(context, fact);
            }
            memory.Remove(fact);
        }
Esempio n. 3
0
        public void PropagateRetract(IExecutionContext context, IList <Fact> facts)
        {
            IAlphaMemory memory    = context.WorkingMemory.GetNodeMemory(this);
            var          toRetract = new List <Fact>(facts.Count);

            foreach (var fact in facts)
            {
                if (memory.Contains(fact))
                {
                    toRetract.Add(fact);
                }
            }
            if (toRetract.Count > 0)
            {
                foreach (var sink in _sinks)
                {
                    sink.PropagateRetract(context, toRetract);
                }
                memory.Remove(toRetract);
            }
        }