I know why you blame me
This commit is contained in:
parent
e14eb1b870
commit
ce95eb2516
3 changed files with 16 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ use crate::formula::node::Node;
|
||||||
pub mod node;
|
pub mod node;
|
||||||
|
|
||||||
pub struct Formula {
|
pub struct Formula {
|
||||||
root: node::Node,
|
root: node::Node<F>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Formula {
|
impl Formula {
|
||||||
|
|
|
||||||
3
src/formula/node/function.rs
Normal file
3
src/formula/node/function.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
pub trait Function {
|
||||||
|
fn map(x: f64) -> f64;
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,27 @@
|
||||||
use crate::formula::node::graph_constructor::GraphBuilder;
|
use crate::formula::node::graph_constructor::GraphBuilder;
|
||||||
|
|
||||||
|
mod function;
|
||||||
mod graph_constructor;
|
mod graph_constructor;
|
||||||
|
|
||||||
pub struct Node {
|
pub struct Node {
|
||||||
children: Vec<Node>,
|
children: Vec<Node>,
|
||||||
|
function: fn(Vec<f64>) -> f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Node {
|
impl Node {
|
||||||
pub fn empty() -> Self {
|
pub fn empty() -> Self {
|
||||||
Node { children: vec![] }
|
Node {
|
||||||
|
children: vec![],
|
||||||
|
function: |_| 0f64,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pub fn build() -> GraphBuilder {
|
pub fn build() -> GraphBuilder {
|
||||||
GraphBuilder
|
GraphBuilder
|
||||||
}
|
}
|
||||||
|
pub fn get_value(&self) -> f64 {
|
||||||
|
if self.children.len() == 0 {
|
||||||
|
0f64
|
||||||
|
}
|
||||||
|
for node in self.children {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue