public void PropagateUpdate(IExecutionContext context, IList <Fact> facts) { IAlphaMemory memory = context.WorkingMemory.GetNodeMemory(this); var toUpdate = new List <Fact>(); var toAssert = new List <Fact>(); foreach (var fact in facts) { if (memory.Contains(fact)) { toUpdate.Add(fact); } else { toAssert.Add(fact); } } if (toUpdate.Count > 0) { foreach (var sink in _sinks) { sink.PropagateUpdate(context, toUpdate); } } if (toAssert.Count > 0) { PropagateAssert(context, toAssert); } }
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); } } }
public void PropagateRetract(IExecutionContext context, Fact fact) { IAlphaMemory memory = context.WorkingMemory.GetNodeMemory(this); if (memory.Contains(fact)) { foreach (var sink in _sinks) { sink.PropagateRetract(context, fact); } memory.Remove(fact); } }
public void PropagateUpdate(IExecutionContext context, Fact fact) { IAlphaMemory memory = context.WorkingMemory.GetNodeMemory(this); if (memory.Contains(fact)) { foreach (var sink in _sinks) { sink.PropagateUpdate(context, fact); } } else { PropagateAssert(context, fact); } }
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); } }