public override void PropagateUpdate(IExecutionContext context, List <Tuple> tuples) { if (_isSubnetJoin) { return; } var toUpdate = new TupleFactList(); var toRetract = new TupleFactList(); using (var counter = PerfCounter.Update(context, this)) { var joinedSets = JoinedSets(context, tuples); 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); } } } counter.AddInputs(tuples.Count); counter.AddOutputs(toUpdate.Count + toRetract.Count); } MemoryNode.PropagateRetract(context, toRetract); MemoryNode.PropagateUpdate(context, toUpdate); }
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 override void PropagateUpdate(IExecutionContext context, IList <Tuple> tuples) { if (_isSubnetJoin) { return; } var joinedSets = JoinedSets(context, tuples); 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); }
private void PropagateAggregateUpdate(IExecutionContext context, Tuple tuple, Fact aggregateFact) { if (aggregateFact != null) { MemoryNode.PropagateUpdate(context, tuple, aggregateFact); } }
public void PropagateUpdate(IExecutionContext context, List <Fact> facts) { var toUpdate = new List <Fact>(); var toRetract = new List <Fact>(); foreach (var fact in facts) { if (IsSatisfiedBy(context, fact)) { toUpdate.Add(fact); } else { toRetract.Add(fact); } } if (toUpdate.Count > 0) { foreach (var childNode in ChildNodes) { childNode.PropagateUpdate(context, toUpdate); } MemoryNode?.PropagateUpdate(context, toUpdate); } if (toRetract.Count > 0) { UnsatisfiedFactUpdate(context, toRetract); } }
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); }
protected void PropagateUpdateInternal(IExecutionContext context, List <Fact> facts) { if (facts.Count == 0) { return; } foreach (var childNode in ChildNodes) { childNode.PropagateUpdate(context, facts); } MemoryNode?.PropagateUpdate(context, facts); }
public override void PropagateUpdate(IExecutionContext context, List <Tuple> tuples) { var toUpdate = new TupleFactList(); foreach (var tuple in tuples) { if (tuple.GetQuantifier(this).Value > 0) { toUpdate.Add(tuple, null); } } MemoryNode.PropagateUpdate(context, toUpdate); }
private void PropagateAggregateUpdates(IExecutionContext context, Aggregation aggregation) { var updates = new TupleFactList(); foreach (var update in aggregation.Updates) { var fact = ToAggregateFact(context, update.ResultObject); updates.Add(update.Tuple, fact); } if (updates.Count > 0) { MemoryNode.PropagateUpdate(context, updates); } }
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); } } }
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 void PropagateUpdate(IExecutionContext context, Fact fact) { if (IsSatisfiedBy(fact)) { foreach (var childNode in ChildNodes) { childNode.PropagateUpdate(context, fact); } if (MemoryNode != null) { MemoryNode.PropagateUpdate(context, fact); } } else { UnsatisfiedFactUpdate(context, fact); } }
public override void PropagateUpdate(IExecutionContext context, IList <Tuple> tuples) { var toUpdate = new TupleFactList(); foreach (var tuple in tuples) { var fact = tuple.GetState <Fact>(this); var oldValue = fact.RawObject; var newValue = BindingExpression.Invoke(context, tuple); if (!ReferenceEquals(oldValue, newValue)) { fact.RawObject = newValue; } toUpdate.Add(tuple, fact); } MemoryNode.PropagateUpdate(context, toUpdate); }
public override void PropagateUpdate(IExecutionContext context, IList <Tuple> tuples) { if (_isSubnetJoin) { return; } var toUpdate = new TupleFactList(); foreach (var tuple in tuples) { IAggregator aggregator = GetAggregator(tuple); foreach (var aggregate in aggregator.Aggregates) { Fact aggregateFact = ToAggregateFact(context, aggregate); toUpdate.Add(tuple, aggregateFact); } } MemoryNode.PropagateUpdate(context, toUpdate); }
public override void PropagateUpdate(IExecutionContext context, List <Tuple> tuples) { var toUpdate = new TupleFactList(); using (var counter = PerfCounter.Update(context, this)) { foreach (var tuple in tuples) { if (context.GetQuantifier(this, tuple).Value > 0) { toUpdate.Add(tuple, null); } } counter.AddInputs(tuples.Count); counter.AddOutputs(toUpdate.Count); } MemoryNode.PropagateUpdate(context, toUpdate); }
public override void PropagateUpdate(IExecutionContext context, IList <Tuple> tuples) { var toUpdate = new TupleFactList(); var joinedSets = JoinedSets(context, tuples); foreach (var set in joinedSets) { if (_isSubnetJoin && HasRightFacts(context, set)) { //Update already propagated from the right continue; } IAggregator aggregator = GetAggregator(set.Tuple); foreach (var aggregate in aggregator.Aggregates) { Fact aggregateFact = ToAggregateFact(context, aggregate); toUpdate.Add(set.Tuple, aggregateFact); } } MemoryNode.PropagateUpdate(context, toUpdate); }
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); }
private void UpdateTuple(IExecutionContext context, Tuple tuple) { MemoryNode.PropagateUpdate(context, tuple, null); }