public RemoveActivation Add <T>(Activation <T> activation) { BetaMemory <T> joinNode = GetJoinNode <T>(); joinNode.AddActivation(activation); return(() => { joinNode.RemoveActivation(activation); }); }
public IBetaMemory GetNodeMemory(IBetaMemoryNode node) { if (!_betaMap.TryGetValue(node, out var memory)) { memory = new BetaMemory(); _betaMap[node] = memory; } return(memory); }
public void FirstTestName() { var junction = new JoinNode<Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryA = new BetaMemory<Customer>(junction); memoryA.Activate(_context); _agenda.Execute(); _context.VerifyAllExpectations(); }
public void FirstTestName() { var junction = new JoinNode<Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryA = new BetaMemory<Customer>(junction); memoryA.Activate(_context); _session.Run(); _primaryCalled.IsCompleted.ShouldBeTrue(); }
public void FirstTestName() { var junction = new JoinNode <Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryA = new BetaMemory <Customer>(junction); memoryA.Activate(_context); _agenda.Execute(); _context.VerifyAllExpectations(); }
public void FirstTestName() { var junction = new JoinNode <Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryA = new BetaMemory <Customer>(junction); memoryA.Activate(_context); _session.Run(); _primaryCalled.IsCompleted.ShouldBeTrue(); }
/// <summary> /// Called when [beta memory] is visited. /// </summary> /// <param name="beta">The beta.</param> public override void OnBetaMemory(BetaMemory beta) { _sb.Append(_indentString).AppendLine(string.Format("Beta: {0}", beta)); _sb.Append(_indentString).AppendLine(" |"); _sb.Append(_indentString).AppendLine(" | ====== MATCHES ======"); foreach (Token item in beta.Items) { item.Accept(this); } _sb.Append(_indentString).AppendLine(" |"); _sb.Append(_indentString).AppendLine(" V"); foreach (ReteNode child in beta.Children) { child.Accept(this); } }
public void Pulling_an_element_through_two_memories_should_merge_properly() { var junction = new JoinNode<Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryB = new BetaMemory<Customer>(junction); var joinJunction = new JoinNode<Customer>(memoryB); var memoryA = new BetaMemory<Customer>(joinJunction); memoryA.Activate(_context); memoryB.Activate(_context); _agenda.Execute(); _context.VerifyAllExpectations(); }
public void Pulling_an_element_through_two_memories_should_merge_properly() { var junction = new JoinNode <Customer>(_constantNode); junction.AddSuccessor(_actionNode); var memoryB = new BetaMemory <Customer>(junction); var joinJunction = new JoinNode <Customer>(memoryB); var memoryA = new BetaMemory <Customer>(joinJunction); memoryA.Activate(_context); memoryB.Activate(_context); _agenda.Execute(); _context.VerifyAllExpectations(); }
public JoinNode(RightActivation <T> rightActivation) { _rightActivation = rightActivation; _betaMemory = new BetaMemory <T>(); }
/// <summary> /// Called when [beta memory] is visited. /// </summary> /// <param name="beta">The beta.</param> public virtual void OnBetaMemory(BetaMemory beta) { }