public void PropagateRetract(IExecutionContext context, List <Fact> facts) { foreach (var childNode in ChildNodes) { childNode.PropagateRetract(context, facts); } MemoryNode?.PropagateRetract(context, facts); }
protected void PropagateRetractInternal(IExecutionContext context, List <Fact> facts) { if (facts.Count == 0) { return; } foreach (var childNode in ChildNodes) { childNode.PropagateRetract(context, facts); } MemoryNode?.PropagateRetract(context, facts); }
public override void PropagateRetract(IExecutionContext context, List <Tuple> tuples) { var toRetract = new TupleFactList(); foreach (var tuple in tuples) { if (tuple.RemoveQuantifier(this).Value == 0) { toRetract.Add(tuple, null); } } MemoryNode.PropagateRetract(context, toRetract); }
public void PropagateRetract(IExecutionContext context, Fact fact) { if (IsSatisfiedBy(fact)) { foreach (var childNode in ChildNodes) { childNode.PropagateRetract(context, fact); } if (MemoryNode != null) { MemoryNode.PropagateRetract(context, fact); } } }
public override void PropagateRetract(IExecutionContext context, IList <Tuple> tuples) { var joinedSets = JoinedSets(context, tuples); var toRetract = new TupleFactList(); foreach (var set in joinedSets) { foreach (var fact in set.Facts) { toRetract.Add(set.Tuple, fact); } } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateRetract(IExecutionContext context, List <Tuple> tuples) { var toRetract = new TupleFactList(); using (var counter = PerfCounter.Retract(context, this)) { foreach (var tuple in tuples) { RetractBinding(context, tuple, toRetract); } counter.AddItems(tuples.Count); } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateRetract(IExecutionContext context, IList <Tuple> tuples) { var toRetract = new TupleFactList(); foreach (var tuple in tuples) { IAggregator aggregator = GetAggregator(tuple); foreach (var aggregate in aggregator.Aggregates) { Fact aggregateFact = ToAggregateFact(context, aggregate); toRetract.Add(tuple, aggregateFact); } } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateUpdate(IExecutionContext context, Fact fact) { IEnumerable <Tuple> tuples = LeftSource.GetTuples(context); foreach (Tuple tuple in tuples) { if (MatchesConditions(context, tuple, fact)) { MemoryNode.PropagateUpdate(context, tuple, fact); } else { MemoryNode.PropagateRetract(context, tuple, fact); } } }
public override void PropagateUpdate(IExecutionContext context, Tuple tuple) { IEnumerable <Fact> facts = RightSource.GetFacts(context); foreach (Fact fact in facts) { if (MatchesConditions(context, tuple, fact)) { MemoryNode.PropagateUpdate(context, tuple, fact); } else { MemoryNode.PropagateRetract(context, tuple, fact); } } }
private void PropagateAggregateRetracts(IExecutionContext context, Aggregation aggregation) { var retracts = new TupleFactList(); foreach (var retract in aggregation.Retracts) { var fact = ToAggregateFact(context, retract.ResultObject); retracts.Add(retract.Tuple, fact); } if (retracts.Count > 0) { MemoryNode.PropagateRetract(context, retracts); var enumerator = retracts.GetEnumerator(); while (enumerator.MoveNext()) { context.WorkingMemory.RemoveInternalFact(this, enumerator.CurrentFact); } } }
public override void PropagateRetract(IExecutionContext context, List <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toRetract = new TupleFactList(); foreach (var set in joinedSets) { var quantifier = set.Tuple.GetQuantifier(this); int startingCount = quantifier.Value; foreach (var fact in set.Facts) { quantifier.Value--; } if (startingCount > 0 && quantifier.Value == 0) { toRetract.Add(set.Tuple, null); } } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateRetract(IExecutionContext context, List <Tuple> tuples) { var toRetract = new TupleFactList(); using (var counter = PerfCounter.Retract(context, this)) { foreach (var tuple in tuples) { if (context.RemoveQuantifier(this, tuple).Value > 0) { toRetract.Add(tuple, null); } } counter.AddInputs(tuples.Count); counter.AddOutputs(toRetract.Count); } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateRetract(IExecutionContext context, List <Tuple> tuples) { var toRetract = new TupleFactList(); using (var counter = PerfCounter.Retract(context, this)) { var joinedSets = JoinedSets(context, tuples); foreach (var set in joinedSets) { foreach (var fact in set.Facts) { toRetract.Add(set.Tuple, fact); } } counter.AddInputs(tuples.Count); counter.AddOutputs(toRetract.Count); } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateUpdate(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); var toUpdate = new TupleFactList(); var toRetract = new TupleFactList(); foreach (var tuple in tuples) { var fact = tuple.GetState <Fact>(this); if (fact != null) { UpdateBinding(context, tuple, fact, toUpdate, toRetract); } else { AssertBinding(context, tuple, toAssert); } } MemoryNode.PropagateRetract(context, toRetract); MemoryNode.PropagateUpdate(context, toUpdate); MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateUpdate(IExecutionContext context, IList <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toUpdate = new TupleFactList(); var toRetract = new TupleFactList(); foreach (var set in joinedSets) { foreach (var fact in set.Facts) { if (MatchesConditions(context, set.Tuple, fact)) { toUpdate.Add(set.Tuple, fact); } else { toRetract.Add(set.Tuple, fact); } } } MemoryNode.PropagateUpdate(context, toUpdate); MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateAssert(IExecutionContext context, IList <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toRetract = new TupleFactList(); foreach (var set in joinedSets) { var quantifier = set.Tuple.Quantifier(this); int startingCount = quantifier.Value; foreach (var fact in set.Facts) { if (MatchesConditions(context, set.Tuple, fact)) { quantifier.Value++; } } if (startingCount == 0 && quantifier.Value > 0) { toRetract.Add(set.Tuple, null); } } MemoryNode.PropagateRetract(context, toRetract); }
public override void PropagateRetract(IExecutionContext context, List <Fact> facts) { var toRetract = new TupleFactList(); using (var counter = PerfCounter.Retract(context, this)) { var joinedSets = JoinedSets(context, facts); foreach (var set in joinedSets) { var quantifier = context.GetQuantifier(this, set.Tuple); int startingCount = quantifier.Value; quantifier.Value -= set.Facts.Count; if (startingCount > 0 && quantifier.Value == 0) { toRetract.Add(set.Tuple, null); } } counter.AddInputs(facts.Count); counter.AddOutputs(toRetract.Count); } MemoryNode.PropagateRetract(context, toRetract); }
private void RetractTuple(IExecutionContext context, Tuple tuple) { MemoryNode.PropagateRetract(context, tuple, null); }