use num_traits::{Float, FromPrimitive, Zero, One};
use crate::smooth::{base::{SmoothApply, SmoothFactory, SmoothType}, impls::{EMAImpl, MedianImpl, RMAImpl, SMAImpl}};
pub struct DefaultSmoothFactory;
impl<T> SmoothFactory<T> for DefaultSmoothFactory
where
T: Float + FromPrimitive + Clone + Zero + One + 'static,
{
fn create(&self, fft_type: SmoothType) -> Box<dyn SmoothApply<T>> {
match fft_type {
SmoothType::SMA => Box::new(SMAImpl),
SmoothType::EMA => Box::new(EMAImpl),
SmoothType::RMA => Box::new(RMAImpl),
SmoothType::MEDIAN => Box::new(MedianImpl)
}
}
}