ReteEngine 1.0
A rules engine and builder
Loading...
Searching...
No Matches
ReteCore.Fact< T > Class Template Reference

The container for any types of data. This class implements INotifyPropertyChanged to allow observers to be notified when the underlying fact changes. It also includes a unique identifier (Id) to ensure that each Fact instance can be uniquely identified. More...

Inheritance diagram for ReteCore.Fact< T >:
ReteCore.IFact

Public Member Functions

 Fact (T data)
 The constructor initializes a new instance of the Fact class with the specified data. It assigns the provided data to the Value property, which in turn sets the underlying fact and raises the PropertyChanged event if necessary.
TValue< T > ()
 A helper method that retrieves the underlying fact value as a specific type T.
override bool Equals (object? obj)
 The Equals method is overridden to provide a way to compare two Fact instances for equality. Two Fact instances are considered equal if they have the same unique identifier (Id). This means that even if two Fact instances contain the same underlying data, they will be treated as distinct unless they share the same Id.
override int GetHashCode ()
 Returns a hash code for this instance, which is based on the unique identifier (Id) of the fact.
override string ToString ()
 The override of the ToString method provides a string representation of the Fact instance.

Protected Member Functions

void OnPropertyChanged ([CallerMemberName] string? propertyName=null)
 When a property value changes, this method is called to raise the PropertyChanged event. The CallerMemberName attribute allows the caller to omit the property name when calling this method, as it will automatically use the name of the calling property.

Properties

Guid Id = Guid.NewGuid() [get]
 A unique identifier.
Value [get, set]
 The templated value of this fact.
object UnderlyingObject [get]
 The data stored as an object type.
Type DataType [get]
 The type of the data stored in this fact. This property returns the Type object representing the generic type parameter T, which indicates the actual type of the data contained in this fact.

Events

PropertyChangedEventHandler PropertyChanged
 The PropertyChanged event is raised whenever a property value changes. Observers can subscribe to this event to be notified of changes to the properties of this class. The event handler receives the name of the property that changed, enabling observers to react.

Detailed Description

The container for any types of data. This class implements INotifyPropertyChanged to allow observers to be notified when the underlying fact changes. It also includes a unique identifier (Id) to ensure that each Fact instance can be uniquely identified.

Member Function Documentation

◆ Equals()

override bool ReteCore.Fact< T >.Equals ( object? obj)

The Equals method is overridden to provide a way to compare two Fact instances for equality. Two Fact instances are considered equal if they have the same unique identifier (Id). This means that even if two Fact instances contain the same underlying data, they will be treated as distinct unless they share the same Id.

Parameters
obj
Returns

◆ Fact()

ReteCore.Fact< T >.Fact ( T data)

The constructor initializes a new instance of the Fact class with the specified data. It assigns the provided data to the Value property, which in turn sets the underlying fact and raises the PropertyChanged event if necessary.

Parameters
data

◆ GetHashCode()

override int ReteCore.Fact< T >.GetHashCode ( )

Returns a hash code for this instance, which is based on the unique identifier (Id) of the fact.

Returns
The unique hash code

◆ OnPropertyChanged()

void ReteCore.Fact< T >.OnPropertyChanged ( [CallerMemberName] string? propertyName = null)
protected

When a property value changes, this method is called to raise the PropertyChanged event. The CallerMemberName attribute allows the caller to omit the property name when calling this method, as it will automatically use the name of the calling property.

Parameters
propertyName

◆ ToString()

override string ReteCore.Fact< T >.ToString ( )

The override of the ToString method provides a string representation of the Fact instance.

Returns
The string representation of the contents.

◆ TValue< T >()

T ReteCore.Fact< T >.TValue< T > ( )

A helper method that retrieves the underlying fact value as a specific type T.

Template Parameters
TThe type of this object
Returns
The templated type

Property Documentation

◆ DataType

Type ReteCore.Fact< T >.DataType
get

The type of the data stored in this fact. This property returns the Type object representing the generic type parameter T, which indicates the actual type of the data contained in this fact.

Implements ReteCore.IFact.

◆ Id

Guid ReteCore.Fact< T >.Id = Guid.NewGuid()
get

A unique identifier.

Implements ReteCore.IFact.

◆ UnderlyingObject

object ReteCore.Fact< T >.UnderlyingObject
get

The data stored as an object type.

Implements ReteCore.IFact.


The documentation for this class was generated from the following file:
  • ReteCore/Token.cs