Class Antecedent
Defined in File antecedent.h
Class Documentation
-
class Antecedent
Represents an antecedent condition in a rule-based system.
This class encapsulates an attribute along with a condition (inequality) that determines whether a given sample satisfies the antecedent. The condition is defined in terms of greater than or less than/equal to a specified value.
Public Functions
-
Antecedent() = default
-
Antecedent(int attribute, bool inequality, double value)
Constructs a new Antecedent object with specified parameters.
Initializes the Antecedent object with the provided attribute ID, inequality flag, and comparison value.
- Parameters:
attribute – Integer ID of the attribute.
inequality – True for ‘>=’, false for ‘<’.
value – The value to compare against.
-
inline int getAttribute() const
Gets the attribute ID.
- Returns:
int The attribute ID.
-
inline bool getInequality() const
Gets the inequality condition.
- Returns:
bool True if the condition is ‘>=’, False if ‘<’.
-
inline double getValue() const
Gets the comparison value.
- Returns:
double The comparison value for the condition.
-
inline void setAttribute(int val)
Sets the attribute ID.
- Parameters:
val – The new attribute ID.
-
inline void setInequality(bool val)
Sets the inequality condition.
- Parameters:
val – True for ‘>=’, False for ‘<’.
-
inline void setValue(double val)
Sets the comparison value.
- Parameters:
val – The new comparison value.
-
bool isEqual(Antecedent other) const
Checks equality with another Antecedent object.
Compares this antecedent with another for equality. Two antecedents are considered equal if they have the same attribute ID, the same inequality condition, and a comparison value that differs by less than a specified epsilon (10^-6).
- Parameters:
other – The other Antecedent to compare with.
- Returns:
True if both Antecedent objects are equal, False otherwise.
-
Antecedent() = default