The IndexedExistsNode class represents a node in a Rete network that efficiently implements the "exists" condition by maintaining indexed collections of tokens and facts. The left side of the node (tokens) is indexed by a key extracted from the tokens, while the right side (facts) is indexed by a key extracted from the facts.
More...
|
| | IndexedExistsNode (string name, Func< Token, object > leftKey, Func< object, object > rightKey) |
| | The constructor for the IndexedExistsNode takes a name for identification, and two selector functions that extract the join key from tokens and facts.
|
| void | AddSuccessor (IReteNode node) |
| | Adds a successor node to this IndexedExistsNode. Successors will receive propagated assertions and retractions when matches are found or lost.
|
| void | Assert (object factOrToken) |
| | The Assert method takes either a Token (from the left side) or a fact (from the right side) and updates the internal indexes accordingly. It then propagates assertions to successors if matches are found.
|
| void | AssertLeft (Token token) |
| | Asserts a token on the left side of the node. It updates the left index and checks for matches on the right side using the extracted key. If matches are found, it propagates assertions to successors.
|
| void | AssertRight (object fact) |
| | Asserts a fact on the right side of the node. It updates the right index and checks for matches on the left side using the extracted key. If matches are found, it propagates assertions to successors.
|
| void | Retract (object factOrToken) |
| | The Retract method takes either a Token (from the left side) or a fact (from the right side) and updates the internal indexes accordingly. It then propagates retractions to successors if matches are lost.
|
| void | RetractLeft (Token token) |
| | Retracts a token from the left side of the node. It updates the left index and checks for matches on the right side using the extracted key. If matches are lost, it propagates retractions to successors.
|
| void | RetractRight (object fact) |
| | Retracts a fact from the right side of the node. It updates the right index and checks for matches on the left side using the extracted key. If matches are lost, it propagates retractions to successors.
|
| void | Refresh (object fact, string propertyName) |
| | The Refresh method is used to update the state of a fact or token in the node without changing its presence. For simplicity, we will treat Refresh as a Retract followed by an Assert, which will trigger the necessary updates to successor nodes based on the current state of matches.
|
| void | DebugPrint (object fact, int level=0) |
| | Prints the internal state of the node for debugging purposes. It shows the current tokens and facts in the indexes, as well as the matches for each token. This can be useful for understanding how the node is processing assertions and retractions.
|
The IndexedExistsNode class represents a node in a Rete network that efficiently implements the "exists" condition by maintaining indexed collections of tokens and facts. The left side of the node (tokens) is indexed by a key extracted from the tokens, while the right side (facts) is indexed by a key extracted from the facts.
◆ IndexedExistsNode()
| ReteCore.IndexedExistsNode.IndexedExistsNode |
( |
string | name, |
|
|
Func< Token, object > | leftKey, |
|
|
Func< object, object > | rightKey ) |
The constructor for the IndexedExistsNode takes a name for identification, and two selector functions that extract the join key from tokens and facts.
- Parameters
-
| name | The name of this node as identification. |
| leftKey | The left token selector function. |
| rightKey | The right fact selector function. |
◆ AddSuccessor()
| void ReteCore.IndexedExistsNode.AddSuccessor |
( |
IReteNode | node | ) |
|
Adds a successor node to this IndexedExistsNode. Successors will receive propagated assertions and retractions when matches are found or lost.
- Parameters
-
| node | The node to add this node to as a successor. |
◆ Assert()
| void ReteCore.IndexedExistsNode.Assert |
( |
object | factOrToken | ) |
|
The Assert method takes either a Token (from the left side) or a fact (from the right side) and updates the internal indexes accordingly. It then propagates assertions to successors if matches are found.
- Parameters
-
| factOrToken | The fact or token this operation is acting upon. |
Implements ReteCore.IReteNode.
◆ AssertLeft()
| void ReteCore.IndexedExistsNode.AssertLeft |
( |
Token | token | ) |
|
Asserts a token on the left side of the node. It updates the left index and checks for matches on the right side using the extracted key. If matches are found, it propagates assertions to successors.
- Parameters
-
| token | The token this operation is acting upon. |
◆ AssertRight()
| void ReteCore.IndexedExistsNode.AssertRight |
( |
object | fact | ) |
|
Asserts a fact on the right side of the node. It updates the right index and checks for matches on the left side using the extracted key. If matches are found, it propagates assertions to successors.
- Parameters
-
| fact | The fact this operation is acting upon. |
◆ DebugPrint()
| void ReteCore.IndexedExistsNode.DebugPrint |
( |
object | fact, |
|
|
int | level = 0 ) |
Prints the internal state of the node for debugging purposes. It shows the current tokens and facts in the indexes, as well as the matches for each token. This can be useful for understanding how the node is processing assertions and retractions.
- Parameters
-
| fact | The fact whose information is to be output. |
| level | A level of indentation. |
Implements ReteCore.IReteNode.
◆ Refresh()
| void ReteCore.IndexedExistsNode.Refresh |
( |
object | fact, |
|
|
string | propertyName ) |
The Refresh method is used to update the state of a fact or token in the node without changing its presence. For simplicity, we will treat Refresh as a Retract followed by an Assert, which will trigger the necessary updates to successor nodes based on the current state of matches.
- Parameters
-
| factOrToken | The fact or token this operation is acting upon. |
| propertyName | The name of the property in the fact cell that is being updated. |
Implements ReteCore.IReteNode.
◆ Retract()
| void ReteCore.IndexedExistsNode.Retract |
( |
object | factOrToken | ) |
|
The Retract method takes either a Token (from the left side) or a fact (from the right side) and updates the internal indexes accordingly. It then propagates retractions to successors if matches are lost.
- Parameters
-
| factOrToken | The fact or token this operation is acting upon. |
Implements ReteCore.IReteNode.
◆ RetractLeft()
| void ReteCore.IndexedExistsNode.RetractLeft |
( |
Token | token | ) |
|
Retracts a token from the left side of the node. It updates the left index and checks for matches on the right side using the extracted key. If matches are lost, it propagates retractions to successors.
- Parameters
-
| token | The token this operation is acting upon. |
◆ RetractRight()
| void ReteCore.IndexedExistsNode.RetractRight |
( |
object | fact | ) |
|
Retracts a fact from the right side of the node. It updates the right index and checks for matches on the left side using the extracted key. If matches are lost, it propagates retractions to successors.
- Parameters
-
| fact | The fact this operation is acting upon. |
The documentation for this class was generated from the following file:
- ReteCore/IndexedExistsNode.cs