Represents a chain of named facts used to track the state and ancestry of rule evaluation in a rule engine.
More...
|
| | Token (string name, object initialFact) |
| | Initializes a new instance of the Token class with the specified name and initial fact.
|
| | Token (Token parent, string nextName, object newFact) |
| | Initializes a new instance of the Token class by extending the specified parent token with an additional named fact.
|
| T | Get< T > (string name) |
| | Retrieves a fact by name and type from the collection.
|
|
override string | ToString () |
|
bool | Equals (Token? other) |
|
override bool | Equals (object? obj) |
|
override int | GetHashCode () |
|
|
static bool | operator== (Token? left, Token? right) |
|
static bool | operator!= (Token? left, Token? right) |
|
| Dictionary< string, object > | NamedFacts = new Dictionary<string, object>() [get] |
| | Gets a collection of named facts associated with the current instance.
|
|
Token | Parent [get, set] |
| | Gets or sets the parent token of this token.
|
|
object | Fact [get] |
| | Gets the fact associated with this instance.
|
Represents a chain of named facts used to track the state and ancestry of rule evaluation in a rule engine.
A Token encapsulates a set of named facts and maintains a reference to its parent token, forming a linked structure that represents the progression of matched facts in a rule evaluation process. Tokens are typically used to accumulate and access facts as rules are matched and extended. Instances are considered equal if their facts and parent tokens are equal. This class is not thread-safe.
◆ Token() [1/2]
| ReteCore.Token.Token |
( |
string | name, |
|
|
object | initialFact ) |
Initializes a new instance of the Token class with the specified name and initial fact.
- Parameters
-
| name | The name to associate with the initial fact. Cannot be null. |
| initialFact | The initial fact to store in the token. Can be any object. |
◆ Token() [2/2]
| ReteCore.Token.Token |
( |
Token | parent, |
|
|
string | nextName, |
|
|
object | newFact ) |
Initializes a new instance of the Token class by extending the specified parent token with an additional named fact.
This constructor creates a new Token that inherits all named facts from the parent token and adds a new fact under the specified name. The resulting Token will contain all facts from the parent, plus the new fact.
- Parameters
-
| parent | The parent Token whose named facts are to be copied and extended. Cannot be null. |
| nextName | The name to associate with the new fact being added. Cannot be null or empty. |
| newFact | The fact object to associate with the specified name. Can be any object. |
◆ Get< T >()
| T ReteCore.Token.Get< T > |
( |
string | name | ) |
|
Retrieves a fact by name and type from the collection.
If the fact exists but is not of type T, this method treats it as not found and throws a KeyNotFoundException.
- Template Parameters
-
| T | The expected type of the fact to retrieve. |
- Parameters
-
| name | The name of the fact to retrieve. Cannot be null. |
- Returns
- The fact associated with the specified name, cast to type T.
- Exceptions
-
| KeyNotFoundException | Thrown if a fact with the specified name and type T does not exist in the collection. |
◆ NamedFacts
| Dictionary<string, object> ReteCore.Token.NamedFacts = new Dictionary<string, object>() |
|
get |
Gets a collection of named facts associated with the current instance.
The dictionary maps fact names to their corresponding values. The collection is read-only; to add or modify facts, use the provided methods or constructors of the containing class, if available.
The documentation for this class was generated from the following file: