|
ReteEngine 1.0
A rules engine and builder
|
The AlphaMemory class represents a node in a Rete network that stores individual facts and propagates them to successor nodes. It maintains a collection of facts that have been asserted and provides methods for asserting, retracting, and refreshing facts. When a fact is asserted, it is added to the collection and propagated to all successor nodes. When a fact is retracted, it is removed from the collection and successors are notified of the retraction. The Refresh method allows for updating the state of a fact without changing its presence in the memory. This class is a fundamental component of the Rete algorithm, enabling efficient pattern matching and rule evaluation in a rule engine. More...
Public Member Functions | |
| void | AddSuccessor (IReteNode node) |
| Adds a successor node to this AlphaMemory. Successor nodes will receive facts asserted, retracted, or refreshed through this AlphaMemory. This method allows for building the Rete network by connecting nodes together. When a new successor is added, it will immediately receive all existing facts in this AlphaMemory through the Assert method, ensuring that the new node is up-to-date with the current state of facts. | |
| void | Assert (object fact) |
| The Assert method adds a fact to the AlphaMemory if it is not already present and propagates it to all successor nodes. | |
| void | Retract (object fact) |
| The Retract method removes a fact from the AlphaMemory if it exists and notifies all successor nodes of the retraction. | |
| void | Refresh (object fact, string propertyName) |
| The Refresh method is used to update the state of a fact in the AlphaMemory without changing its presence. If the fact exists, it propagates the refresh to all successor nodes, allowing them to update their state based on the new information. | |
| void | DebugPrint (object fact, int level=0) |
| A debugging method that prints the current state of the AlphaMemory, including whether a specific fact is present and the total number of facts stored. | |
Properties | |
| List< object > | Facts = new() [get] |
| A collection of facts that have been asserted into this AlphaMemory. Each fact is stored as an object, and the collection allows for efficient checking of whether a fact is already present. When a new fact is asserted, it is added to this collection if it is not already present, and when a fact is retracted, it is removed from the collection. The presence of a fact in this collection determines whether it will be propagated to successor nodes when operations are performed on it. | |
The AlphaMemory class represents a node in a Rete network that stores individual facts and propagates them to successor nodes. It maintains a collection of facts that have been asserted and provides methods for asserting, retracting, and refreshing facts. When a fact is asserted, it is added to the collection and propagated to all successor nodes. When a fact is retracted, it is removed from the collection and successors are notified of the retraction. The Refresh method allows for updating the state of a fact without changing its presence in the memory. This class is a fundamental component of the Rete algorithm, enabling efficient pattern matching and rule evaluation in a rule engine.
| void ReteCore.AlphaMemory.AddSuccessor | ( | IReteNode | node | ) |
Adds a successor node to this AlphaMemory. Successor nodes will receive facts asserted, retracted, or refreshed through this AlphaMemory. This method allows for building the Rete network by connecting nodes together. When a new successor is added, it will immediately receive all existing facts in this AlphaMemory through the Assert method, ensuring that the new node is up-to-date with the current state of facts.
| node | The node to add as a successor. Cannot be null. |
| void ReteCore.AlphaMemory.Assert | ( | object | fact | ) |
The Assert method adds a fact to the AlphaMemory if it is not already present and propagates it to all successor nodes.
| fact | The fact object to be asserted and passed to successor nodes. Cannot be null. |
Implements ReteCore.IReteNode.
| void ReteCore.AlphaMemory.DebugPrint | ( | object | fact, |
| int | level = 0 ) |
A debugging method that prints the current state of the AlphaMemory, including whether a specific fact is present and the total number of facts stored.
| 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.AlphaMemory.Refresh | ( | object | fact, |
| string | propertyName ) |
The Refresh method is used to update the state of a fact in the AlphaMemory without changing its presence. If the fact exists, it propagates the refresh to all successor nodes, allowing them to update their state based on the new information.
| 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.AlphaMemory.Retract | ( | object | fact | ) |
The Retract method removes a fact from the AlphaMemory if it exists and notifies all successor nodes of the retraction.
| fact | The fact object to retract. Cannot be null. |
Implements ReteCore.IReteNode.