public override void PropagateUpdate(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); var toUpdate = new TupleFactList(); var toRetract = new TupleFactList(); using (var counter = PerfCounter.Update(context, this)) { foreach (var tuple in tuples) { var fact = context.WorkingMemory.GetState <Fact>(this, tuple); if (fact != null) { UpdateBinding(context, tuple, fact, toUpdate, toRetract); } else { AssertBinding(context, tuple, toAssert); } } counter.AddItems(tuples.Count); } MemoryNode.PropagateRetract(context, toRetract); MemoryNode.PropagateUpdate(context, toUpdate); MemoryNode.PropagateAssert(context, toAssert); }
private void PropagateAggregateAssert(IExecutionContext context, Tuple tuple, Fact aggregateFact) { if (aggregateFact != null) { MemoryNode.PropagateAssert(context, tuple, aggregateFact); } }
private void PropagateAggregation(IExecutionContext context, Aggregation aggregation) { foreach (var aggregateList in aggregation.AggregateLists) { if (aggregateList.Count == 0) { continue; } switch (aggregateList.Action) { case AggregationAction.Added: MemoryNode.PropagateAssert(context, aggregateList); break; case AggregationAction.Modified: MemoryNode.PropagateUpdate(context, aggregateList); break; case AggregationAction.Removed: MemoryNode.PropagateRetract(context, aggregateList); break; } } }
public virtual void PropagateAssert(IExecutionContext context, List <Fact> facts) { var toAssert = new List <Fact>(); using (var counter = PerfCounter.Assert(context, this)) { foreach (var fact in facts) { if (IsSatisfiedBy(context, fact)) { toAssert.Add(fact); } } counter.AddInputs(facts.Count); counter.AddOutputs(toAssert.Count); } if (toAssert.Count > 0) { foreach (var childNode in ChildNodes) { childNode.PropagateAssert(context, toAssert); } MemoryNode?.PropagateAssert(context, toAssert); } }
public override void PropagateAssert(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); foreach (var tuple in tuples) { AssertBinding(context, tuple, toAssert); } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateAssert(IExecutionContext context, Fact fact) { IEnumerable <Tuple> tuples = LeftSource.GetTuples(context); foreach (Tuple tuple in tuples) { if (MatchesConditions(context, tuple, fact)) { MemoryNode.PropagateAssert(context, tuple, fact); } } }
public override void PropagateAssert(IExecutionContext context, Tuple tuple) { IEnumerable <Fact> facts = RightSource.GetFacts(context); foreach (Fact fact in facts) { if (MatchesConditions(context, tuple, fact)) { MemoryNode.PropagateAssert(context, tuple, fact); } } }
public override void PropagateAssert(IExecutionContext context, IList <Tuple> tuples) { var toAssert = new TupleFactList(); foreach (var tuple in tuples) { var value = BindingExpression.Invoke(context, tuple); var fact = new Fact(value, ResultType); tuple.SetState(this, fact); toAssert.Add(tuple, fact); } MemoryNode.PropagateAssert(context, toAssert); }
public void PropagateAssert(IExecutionContext context, Fact fact) { if (IsSatisfiedBy(fact)) { foreach (var childNode in ChildNodes) { childNode.PropagateAssert(context, fact); } if (MemoryNode != null) { MemoryNode.PropagateAssert(context, fact); } } }
private void PropagateAggregateAsserts(IExecutionContext context, Aggregation aggregation) { var asserts = new TupleFactList(); foreach (var assert in aggregation.Asserts) { var fact = ToAggregateFact(context, assert.ResultObject); asserts.Add(assert.Tuple, fact); } if (asserts.Count > 0) { MemoryNode.PropagateAssert(context, asserts); } }
public override void PropagateAssert(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); using (var counter = PerfCounter.Assert(context, this)) { foreach (var tuple in tuples) { AssertBinding(context, tuple, toAssert); } counter.AddItems(tuples.Count); } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateAssert(IExecutionContext context, IList <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toAssert = new TupleFactList(); foreach (var set in joinedSets) { foreach (var fact in set.Facts) { if (MatchesConditions(context, set.Tuple, fact)) { toAssert.Add(set.Tuple, fact); } } } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateAssert(IExecutionContext context, List <Tuple> tuples) { var joinedSets = JoinedSets(context, tuples); var toAssert = new TupleFactList(); foreach (var set in joinedSets) { var quantifier = set.Tuple.CreateQuantifier(this); foreach (var fact in set.Facts) { quantifier.Value++; } if (quantifier.Value > 0) { toAssert.Add(set.Tuple, null); } } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateAssert(IExecutionContext context, List <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toAssert = 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) { toAssert.Add(set.Tuple, null); } } MemoryNode.PropagateAssert(context, toAssert); }
public void PropagateAssert(IExecutionContext context, List <Fact> facts) { var toAssert = new List <Fact>(); foreach (var fact in facts) { if (IsSatisfiedBy(context, fact)) { toAssert.Add(fact); } } if (toAssert.Count > 0) { foreach (var childNode in ChildNodes) { childNode.PropagateAssert(context, toAssert); } MemoryNode?.PropagateAssert(context, toAssert); } }
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 PropagateAssert(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); using (var counter = PerfCounter.Assert(context, this)) { var joinedSets = JoinedSets(context, tuples); foreach (var set in joinedSets) { var quantifier = context.CreateQuantifier(this, set.Tuple); quantifier.Value += set.Facts.Count; if (quantifier.Value > 0) { toAssert.Add(set.Tuple, null); } } counter.AddInputs(tuples.Count); counter.AddOutputs(toAssert.Count); } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateRetract(IExecutionContext context, IList <Fact> facts) { var joinedSets = JoinedSets(context, facts); var toAssert = 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) { toAssert.Add(set.Tuple, null); } } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateRetract(IExecutionContext context, List <Fact> facts) { var toAssert = 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) { toAssert.Add(set.Tuple, null); } } counter.AddInputs(facts.Count); counter.AddOutputs(toAssert.Count); } MemoryNode.PropagateAssert(context, toAssert); }
public override void PropagateAssert(IExecutionContext context, List <Tuple> tuples) { var toAssert = new TupleFactList(); using (var counter = PerfCounter.Assert(context, this)) { var joinedSets = JoinedSets(context, tuples); foreach (var set in joinedSets) { foreach (var fact in set.Facts) { if (MatchesConditions(context, set.Tuple, fact)) { toAssert.Add(set.Tuple, fact); } } } counter.AddInputs(tuples.Count); counter.AddOutputs(toAssert.Count); } MemoryNode.PropagateAssert(context, toAssert); }
private void AssertTuple(IExecutionContext context, Tuple tuple) { MemoryNode.PropagateAssert(context, tuple, null); }