1use crate::dsl::Expr;
2
3#[derive(Default)]
4pub struct Rules<T>(pub(crate) Vec<Rule<T>>);
5
6impl<T> Rules<T> {
7 pub fn new() -> Self {
8 Rules(Vec::new())
9 }
10
11 pub fn with_capacity(capacity: usize) -> Self {
12 Rules(Vec::with_capacity(capacity))
13 }
14
15 pub fn add(&mut self, premise: Expr<T>, consequence: Expr<T>) {
18 self.0.push(Rule {
19 premise,
20 consequence,
21 cf: 1.0,
23 threshold_cf: 0.,
24 });
25 }
26}
27
28pub(crate) struct Rule<T> {
29 pub(crate) premise: Expr<T>,
31 pub(crate) consequence: Expr<T>,
33 pub(crate) cf: f64,
34 pub(crate) threshold_cf: f64,
35}