use crate::optimizer::rule::RuleImpl;
#[derive(Clone)]
pub struct HepBatch {
pub name: String,
pub strategy: HepBatchStrategy,
pub rules: Vec<RuleImpl>,
}
impl HepBatch {
pub fn new(name: String, strategy: HepBatchStrategy, rules: Vec<RuleImpl>) -> Self {
Self {
name,
strategy,
rules,
}
}
}
#[derive(Clone)]
pub struct HepBatchStrategy {
pub max_iteration: usize,
pub match_order: HepMatchOrder,
}
impl HepBatchStrategy {
pub fn once_topdown() -> Self {
HepBatchStrategy {
max_iteration: 1,
match_order: HepMatchOrder::TopDown,
}
}
pub fn fix_point_topdown(max_iteration: usize) -> Self {
HepBatchStrategy {
max_iteration,
match_order: HepMatchOrder::TopDown,
}
}
}
#[derive(Clone, Copy)]
pub enum HepMatchOrder {
TopDown,
#[allow(dead_code)]
BottomUp,
}