|
ReteEngine 1.0
A rules engine and builder
|
The CompositeBetaMemory class represents a node in a Rete network that combines multiple branches of tokens (partial matches) using an OR logic. More...
Public Member Functions | |
| void | AddSuccessor (IReteNode node) |
| Adds a successor node to this CompositeBetaMemory. Successor nodes will receive assertions and retractions for any tokens that become active or inactive in this node. This method allows the Rete network to be dynamically constructed, enabling the flow of matches through the network as conditions are evaluated. When a new successor is added, it will immediately receive assertions for all currently active tokens, ensuring that it is up-to-date with the current state of matches in this node. | |
| void | Assert (object fact) |
| Asserts a fact (token) into this CompositeBetaMemory. If the token is not already supported by any branch, it will be added to the _supportedMatches dictionary with an initial count of 1, and the assertion will be propagated to all successor nodes. If the token is already supported, the count will simply be incremented, indicating that another branch supports this match. This method ensures that the node accurately tracks which tokens are active based on the branches that support them, allowing for correct propagation of matches through the network. | |
| void | Retract (object fact) |
| Retracts a fact (token) from this CompositeBetaMemory. If the token is supported by only one branch, it will be removed from the _supportedMatches dictionary, and the retraction will be propagated to all successor nodes. If the token is supported by multiple branches, the count will simply be decremented, indicating that one less branch supports this match. This method ensures that the node accurately tracks which tokens are active based on the branches that support them, allowing for correct propagation of matches through the network as conditions change. | |
| void | Refresh (object fact, string propertyName) |
| Refreshes a fact (token) in this CompositeBetaMemory. This method is called when a property of a fact changes, and it allows the node to re-evaluate the token against its conditions. The refresh will be propagated to all successor nodes, ensuring that any changes in the token's properties are reflected in the matches that are active in those nodes. This method is essential for maintaining the accuracy of matches in the network as facts evolve over time. | |
| void | DebugPrint (object fact, int level=0) |
| This method is used for debugging purposes to print the current state of the CompositeBetaMemory. It displays the fact being processed, whether it is currently active (supported by at least one branch), and recursively prints. | |
Properties | |
| IEnumerable< Token > | Tokens [get] |
| A collection of tokens that are currently supported by at least one branch in this CompositeBetaMemory. Each token is associated with a count of how many branches support it, allowing the node to manage the activation and deactivation of matches as branches are asserted and retracted. This property provides access to the active tokens that have been propagated through this node, enabling successor nodes to evaluate their conditions based on these matches. | |
The CompositeBetaMemory class represents a node in a Rete network that combines multiple branches of tokens (partial matches) using an OR logic.
| void ReteCore.CompositeBetaMemory.AddSuccessor | ( | IReteNode | node | ) |
Adds a successor node to this CompositeBetaMemory. Successor nodes will receive assertions and retractions for any tokens that become active or inactive in this node. This method allows the Rete network to be dynamically constructed, enabling the flow of matches through the network as conditions are evaluated. When a new successor is added, it will immediately receive assertions for all currently active tokens, ensuring that it is up-to-date with the current state of matches in this node.
| node | The node to add as a successor. Cannot be null. |
| void ReteCore.CompositeBetaMemory.Assert | ( | object | fact | ) |
Asserts a fact (token) into this CompositeBetaMemory. If the token is not already supported by any branch, it will be added to the _supportedMatches dictionary with an initial count of 1, and the assertion will be propagated to all successor nodes. If the token is already supported, the count will simply be incremented, indicating that another branch supports this match. This method ensures that the node accurately tracks which tokens are active based on the branches that support them, allowing for correct propagation of matches through the network.
| fact | The fact object to be asserted and passed to successor nodes. Cannot be null. |
Implements ReteCore.IReteNode.
| void ReteCore.CompositeBetaMemory.DebugPrint | ( | object | fact, |
| int | level = 0 ) |
This method is used for debugging purposes to print the current state of the CompositeBetaMemory. It displays the fact being processed, whether it is currently active (supported by at least one branch), and recursively prints.
| fact | The fact object to include in the debug output. Can be any object; its string representation will be printed. |
| level | The indentation level to apply to the debug message. Each level increases indentation by spaces. Defaults to 0. |
Implements ReteCore.IReteNode.
| void ReteCore.CompositeBetaMemory.Refresh | ( | object | fact, |
| string | propertyName ) |
Refreshes a fact (token) in this CompositeBetaMemory. This method is called when a property of a fact changes, and it allows the node to re-evaluate the token against its conditions. The refresh will be propagated to all successor nodes, ensuring that any changes in the token's properties are reflected in the matches that are active in those nodes. This method is essential for maintaining the accuracy of matches in the network as facts evolve over time.
| fact | The fact object whose property is being refreshed. Cannot be null. |
| propertyName | The name of the property to refresh. Cannot be null or empty. |
Implements ReteCore.IReteNode.
| void ReteCore.CompositeBetaMemory.Retract | ( | object | fact | ) |
Retracts a fact (token) from this CompositeBetaMemory. If the token is supported by only one branch, it will be removed from the _supportedMatches dictionary, and the retraction will be propagated to all successor nodes. If the token is supported by multiple branches, the count will simply be decremented, indicating that one less branch supports this match. This method ensures that the node accurately tracks which tokens are active based on the branches that support them, allowing for correct propagation of matches through the network as conditions change.
| fact | The fact object to retract. Cannot be null. |
Implements ReteCore.IReteNode.
|
get |
A collection of tokens that are currently supported by at least one branch in this CompositeBetaMemory. Each token is associated with a count of how many branches support it, allowing the node to manage the activation and deactivation of matches as branches are asserted and retracted. This property provides access to the active tokens that have been propagated through this node, enabling successor nodes to evaluate their conditions based on these matches.
Implements ReteCore.ILatentMemory.