pub mod abs;
pub mod abs_eval;
pub mod exp_eval;
pub mod exponential;
pub mod hyperbolic;
pub mod hyperbolic_eval;
pub mod log_eval;
pub mod logarithmic;
pub mod rounding;
pub mod sqrt;
pub mod sqrt_eval;
pub mod trigonometric;
use crate::functions::properties::FunctionProperties;
use std::collections::HashMap;
pub struct ElementaryIntelligence {
absolute_value: abs::AbsoluteValueIntelligence,
square_root: sqrt::SqrtIntelligence,
trigonometric: trigonometric::TrigonometricIntelligence,
exponential: exponential::ExponentialIntelligence,
logarithmic: logarithmic::LogarithmicIntelligence,
hyperbolic: hyperbolic::HyperbolicIntelligence,
}
impl Default for ElementaryIntelligence {
fn default() -> Self {
Self::new()
}
}
impl ElementaryIntelligence {
pub fn new() -> Self {
Self {
absolute_value: abs::AbsoluteValueIntelligence::new(),
square_root: sqrt::SqrtIntelligence::new(),
trigonometric: trigonometric::TrigonometricIntelligence::new(),
exponential: exponential::ExponentialIntelligence::new(),
logarithmic: logarithmic::LogarithmicIntelligence::new(),
hyperbolic: hyperbolic::HyperbolicIntelligence::new(),
}
}
pub fn get_all_properties(&self) -> HashMap<String, FunctionProperties> {
let mut properties = HashMap::with_capacity(32);
properties.extend(self.absolute_value.get_properties());
properties.extend(self.square_root.get_properties());
properties.extend(self.trigonometric.get_properties());
properties.extend(self.exponential.get_properties());
properties.extend(self.logarithmic.get_properties());
properties.extend(self.hyperbolic.get_properties());
properties
}
pub fn is_elementary_function(&self, name: &str) -> bool {
self.absolute_value.has_function(name)
|| self.square_root.has_function(name)
|| self.trigonometric.has_function(name)
|| self.exponential.has_function(name)
|| self.logarithmic.has_function(name)
|| self.hyperbolic.has_function(name)
}
}