use crate::dsl::Expr;
#[derive(Default)]
pub struct Rules<T>(pub(crate) Vec<Rule<T>>);
impl<T> Rules<T> {
pub fn new() -> Self {
Rules(Vec::new())
}
pub fn with_capacity(capacity: usize) -> Self {
Rules(Vec::with_capacity(capacity))
}
pub fn add(&mut self, premise: Expr<T>, consequence: Expr<T>) {
self.0.push(Rule {
premise,
consequence,
cf: 1.0,
threshold_cf: 0.,
});
}
}
pub(crate) struct Rule<T> {
pub(crate) premise: Expr<T>,
pub(crate) consequence: Expr<T>,
pub(crate) cf: f64,
pub(crate) threshold_cf: f64,
}